Browse Source

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.
travis-debug
Christian Decker 5 years ago
committed by Rusty Russell
parent
commit
cf8c972883
  1. 7
      contrib/pyln-testing/pyln/testing/fixtures.py

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

@ -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))

Loading…
Cancel
Save