python-pytest-harvest
python-pytest-harvest copied to clipboard
Bug? FileNotFound on cleanup
Neat plugin, great docs. I'm running into the following issue, outlined below:
Scenario:
- pytest 6.0.1
- pytest-harvest 1.10.0
- pytest-xdist 2.0.0
- running via a shiv
- running multiple instances of pytest simultaneously
stacktrace:
File "/home/builduser/.shiv/pytest_f6cdbae7-eadd-41ab-aef2-dd73926c7212/site-packages/pytest_harvest/plugin.py", line 435, in pytest_harvest_xdist_cleanup
rmtree(self.results_path)
File "/usr/lib/python3.7/shutil.py", line 485, in rmtree
onerror(os.lstat, path, sys.exc_info())
File "/usr/lib/python3.7/shutil.py", line 483, in rmtree
orig_st = os.lstat(path)
FileNotFoundError: [Errno 2] No such file or directory: '.xdist_harvested'
How is self.results_path
generated? it it unique per process? or would it be shared if I was running two copies of pytest simultaneously, thus leading to the following error?
EDIT: I should probably mention I'm only using the following hook in my root conftest.py
def pytest_sessionfinish(session):
""" Gather all results and save them to a csv.
Works both on worker and master nodes, and also with xdist disabled"""
session_results_df = get_session_results_df(session)
suffix = 'all' if is_main_process(session) else get_xdist_worker_id(session)
session_results_df.to_csv('results_%s.csv' % suffix)