6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-12 14:17:46 +00:00
tutor/tests/commands/test_context.py
Régis Behmo 16e6131f96 feat: pluggable local/dev/k8s do <job> commands
We introduce a new filter to implement custom commands in arbitrary containers.
It becomes easy to write convenient ad-hoc commands that users will
then be able to run either on Kubernetes or locally using a documented CLI.

Pluggable jobs are declared as Click commands and are responsible for
parsing their own arguments. See the new CLI_DO_COMMANDS filter.

Close https://github.com/overhangio/2u-tutor-adoption/issues/75
2022-11-15 09:46:08 +01:00

19 lines
662 B
Python

import os
import unittest
from tests.helpers import TestContext, TestTaskRunner, temporary_root
from tutor import config as tutor_config
class TestContextTests(unittest.TestCase):
def test_create_testcontext(self) -> None:
with temporary_root() as root:
context = TestContext(root)
config = tutor_config.load_full(root)
runner = context.job_runner(config)
self.assertTrue(os.path.exists(context.root))
self.assertFalse(
os.path.exists(os.path.join(context.root, tutor_config.CONFIG_FILENAME))
)
self.assertTrue(isinstance(runner, TestTaskRunner))