Add tests for commands working directories

This commit is contained in:
Jake Howard 2018-12-21 14:02:27 +00:00
parent 3646407227
commit 2c9af76b88
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 14 additions and 0 deletions

View file

@ -22,3 +22,9 @@ class ProjectRunCLITestCase(BaseTestCase):
self.assertIn(str(self.project.root), env["PATH"]) self.assertIn(str(self.project.root), env["PATH"])
for path in self.project.get_extra_path(): for path in self.project.get_extra_path():
self.assertIn(str(path), env["PATH"]) self.assertIn(str(path), env["PATH"])
def test_sets_working_dir(self):
with self.in_example_dir():
result = self.run_cli(["project", "run", "pwd"], catch_exceptions=False)
self.assertEqual(result.exit_code, 0)
self.assertEqual(result.stdout.strip(), str(self.project.root))

View file

@ -55,6 +55,14 @@ class ProcessWorkerTestCase(BaseWorkerTestCase):
for path in self.project.get_extra_path(): for path in self.project.get_extra_path():
self.assertIn(str(path), path_dirs) self.assertIn(str(path), path_dirs)
def test_sets_working_dir(self):
response = send_to_server(
PayloadType.PROCESS,
{"path": str(self.project.root), "process": str(self.process.name)},
)
cwd = psutil.Process(response["pid"]).cwd()
self.assertEqual(cwd, str(self.project.root))
def test_process_restart(self): def test_process_restart(self):
response = send_to_server( response = send_to_server(
PayloadType.PROCESS, PayloadType.PROCESS,