Add tests for commands working directories
This commit is contained in:
parent
3646407227
commit
2c9af76b88
2 changed files with 14 additions and 0 deletions
|
@ -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))
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Reference in a new issue