From a0bc946db306b921fd2db909377e72bf6671e843 Mon Sep 17 00:00:00 2001 From: Tiago Natel de Moura Date: Fri, 8 Jan 2021 10:38:46 +0000 Subject: Tests: fixed test_respawn.py to act upon test processes. Running `test_respawn_` test cases on a machine with Unit daemon in background would fail tests because `ps ax` was used without filtering out other unit instances. This patch also prevents from tests killing other Unit processes not related to tests. --- test/conftest.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/conftest.py') diff --git a/test/conftest.py b/test/conftest.py index d87e648b..0a4b541d 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -443,6 +443,10 @@ def is_unsafe(request): def is_su(request): return os.geteuid() == 0 +@pytest.fixture +def unit_pid(request): + return unit_instance['process'].pid + def pytest_sessionfinish(session): unit_stop() shutil.rmtree(option.cache_dir) -- cgit