pytest: Actually make sure that the direcory exists

Some tests may not spawn a node at all, so make sure that our assumption that
the directory exists in the fixture cleanup is correct by creating the
directory.
This commit is contained in:
Christian Decker
2020-01-26 13:44:53 +01:00
committed by Rusty Russell
parent 751df868c7
commit 24aaf73982
2 changed files with 3 additions and 2 deletions

View File

@@ -41,6 +41,9 @@ def directory(request, test_base_dir, test_name):
directory = os.path.join(test_base_dir, "{}_{}".format(test_name, __attempts[test_name]))
request.node.has_errors = False
if not os.path.exists(directory):
os.makedirs(directory)
yield directory
# This uses the status set in conftest.pytest_runtest_makereport to