24 lines
841 B
Python
24 lines
841 B
Python
from io import StringIO
|
|
|
|
from dotenv import dotenv_values
|
|
|
|
from catfish.project import Project
|
|
from tests import BaseTestCase
|
|
|
|
|
|
class ProjectRunCLITestCase(BaseTestCase):
|
|
def setUp(self):
|
|
super().setUp()
|
|
self.project = Project(self.EXAMPLE_DIR)
|
|
|
|
def test_sets_environment(self):
|
|
with self.in_example_dir():
|
|
result = self.run_cli(["project", "run", "env"], catch_exceptions=False)
|
|
self.assertEqual(result.exit_code, 0)
|
|
env = dotenv_values(stream=StringIO(result.stdout))
|
|
self.assertEqual(env["FOO"], "bar")
|
|
self.assertEqual(env["PYTHONUNBUFFERED"], "1")
|
|
self.assertIsNone(env.get("CATFISH_IDENT"))
|
|
self.assertIn(str(self.project.root), env["PATH"])
|
|
for path in self.project.get_extra_path():
|
|
self.assertIn(str(path), env["PATH"])
|