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.
This commit is contained in:
Tiago Natel de Moura
2021-01-08 10:38:46 +00:00
parent 13a06497de
commit a0bc946db3
2 changed files with 32 additions and 23 deletions

View File

@@ -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)