Skip to content

Commit 8f61a48

Browse files
committed
tests: add TEST_KEEPDIR to prevent cleanup of successful tests
1 parent baedf75 commit 8f61a48

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
@@ -32,6 +32,9 @@ def test_base_dir():
3232

3333
yield directory
3434

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

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

0 commit comments

Comments
 (0)