mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
pyln-testing: Print a list of files if we can't remove the test dir
For some reason we fail to remove the test directory in some cases. My hypothesis is that it is a daemon that is not completely shut down yet, and still writes to the directory. This commit intercepts the error, prints any files in the directory and re-raises the error. This should allow us to debug the reappears.
This commit is contained in:
committed by
Rusty Russell
parent
3e3b05e1b2
commit
cf8c972883
@@ -55,7 +55,12 @@ def directory(request, test_base_dir, test_name):
|
||||
failed = not outcome or request.node.has_errors or outcome != 'passed'
|
||||
|
||||
if not failed:
|
||||
shutil.rmtree(directory)
|
||||
try:
|
||||
shutil.rmtree(directory)
|
||||
except Exception:
|
||||
files = [os.path.join(dp, f) for dp, dn, fn in os.walk(directory) for f in fn]
|
||||
print("Directory still contains files:", files)
|
||||
raise
|
||||
else:
|
||||
logging.debug("Test execution failed, leaving the test directory {} intact.".format(directory))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user