mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-11-15 17:47:13 +00:00
1c927c6e96
This introduces a new dev/local command: tutor dev bindmount CONTAINER PATH And a new volume syntax: tutor dev run --volume=PATH CONTAINER This syntax automatically bind-mounts folders from the tutorroot/volumes directory, which is pretty nifty.
32 lines
998 B
Python
32 lines
998 B
Python
import unittest
|
|
|
|
from tutor import bindmounts
|
|
from tutor.exceptions import TutorError
|
|
|
|
|
|
class BindMountsTests(unittest.TestCase):
|
|
def test_get_name(self):
|
|
self.assertEqual("venv", bindmounts.get_name("/openedx/venv"))
|
|
self.assertEqual("venv", bindmounts.get_name("/openedx/venv/"))
|
|
|
|
def test_get_name_root_folder(self):
|
|
with self.assertRaises(TutorError):
|
|
bindmounts.get_name("/")
|
|
with self.assertRaises(TutorError):
|
|
bindmounts.get_name("")
|
|
|
|
def test_parse_volumes(self):
|
|
volume_args, non_volume_args = bindmounts.parse_volumes(
|
|
[
|
|
"run",
|
|
"--volume=/openedx/venv",
|
|
"-v",
|
|
"/tmp/openedx:/openedx",
|
|
"lms",
|
|
"echo",
|
|
"boom",
|
|
]
|
|
)
|
|
self.assertEqual(("/openedx/venv", "/tmp/openedx:/openedx"), volume_args)
|
|
self.assertEqual(("run", "lms", "echo", "boom"), non_volume_args)
|