Skip to content

Commit 17be74f

Browse files
committed
tests: add TEST_KEEPDIR to prevent cleanup of successful tests
1 parent 7f992b1 commit 17be74f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

contrib/pyln-testing/pyln/testing/fixtures.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ def test_base_dir():
3131

3232
yield directory
3333

34+
if bool(int(os.getenv('TEST_KEEPDIR', '0'))):
35+
return
36+
3437
# Now check if any test directory is left because the corresponding test
3538
# failed. If there are no such tests we can clean up the root test
3639
# directory.
@@ -92,7 +95,7 @@ def directory(request, test_base_dir, test_name):
9295
outcome = 'passed' if rep_call is None else rep_call.outcome
9396
failed = not outcome or request.node.has_errors or outcome != 'passed'
9497

95-
if not failed:
98+
if not failed and not bool(int(os.getenv('TEST_KEEPDIR', '0'))):
9699
try:
97100
shutil.rmtree(directory)
98101
except OSError:

0 commit comments

Comments
 (0)