refactor: dvc.daemon (#10045)

* minor refactor to dvc.daemon

* fix tests

* run daemon only inside a subprocess
This commit is contained in:
skshetry
2023-10-30 11:09:55 +05:45
committed by GitHub
parent 3fee81f1be
commit 48f1f52c1b
2 changed files with 76 additions and 121 deletions
+3 -11
View File
@@ -5,19 +5,11 @@ from dvc import daemon
def test_daemon(mocker):
mock_windows = mocker.patch("dvc.daemon._spawn_subprocess")
mock_posix = mocker.patch("dvc.daemon._spawn_posix")
mock = mocker.patch("dvc.daemon._spawn")
daemon.daemon(["updater"])
if os.name == "nt":
mock_posix.assert_not_called()
mock_windows.assert_called()
args = mock_windows.call_args[0]
else:
mock_windows.assert_not_called()
mock_posix.assert_called()
args = mock_posix.call_args[0]
mock.assert_called()
args = mock.call_args[0]
env = args[2]
assert "PYTHONPATH" in env