mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
pyln: Allow the base test directory to contain some files
We were not removing the base test directory if we had other files in there, which was the case for postgres runs. This now explicitly check for `test_*` directories which are an indicator of a failed test.
This commit is contained in:
parent
aeb5f969e2
commit
7e99a3b5fd
@ -26,8 +26,16 @@ def test_base_dir():
|
||||
|
||||
yield directory
|
||||
|
||||
if os.listdir(directory) == []:
|
||||
# Now check if any test directory is left because the corresponding test
|
||||
# failed. If there are no such tests we can clean up the root test
|
||||
# directory.
|
||||
contents = [d for d in os.listdir(directory) if os.path.isdir(d) and d.startswith('test_')]
|
||||
if contents == []:
|
||||
shutil.rmtree(directory)
|
||||
else:
|
||||
print("Leaving base_dir {} intact, it still has test sub-directories with failure details: {}".format(
|
||||
directory, contents
|
||||
))
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
|
Loading…
Reference in New Issue
Block a user