This repository has been archived by the owner on Dec 10, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent cleanup error at end of pants test with --test-junit-html-rep…
…ort option, update safe_rmtree to be symlink aware If you run ./pants test in our repo twice on JVM targets without cleaning up in between you'll see this error: ``` ... File ".../pants/backend/jvm/tasks/junit_run.py", line 667, in _isolation shutil.rmtree(path) File ".../Versions/2.7/lib/python2.7/shutil.py", line 232, in rmtree onerror(os.path.islink, path, sys.exc_info()) File ".../Versions/2.7/lib/python2.7/shutil.py", line 230, in rmtree raise OSError("Cannot call rmtree on a symbolic link") ``` To repro in the pants repo, run: ``` ./pants clean-all ./pants test tests/java/org/pantsbuild/args4j --test-junit-html-report ./pants test tests/java/org/pantsbuild/args4j --test-junit-html-report ``` Fails on the second time running the test goal. During debugging, I found the path its trying to remove is `.pants.d/test/junit/reports` ``` $ ls -l .pants.d/test/junit/reports .pants.d/test/junit/reports -> /Users/zundel/Src/pants-release/.pants.d/test/junit/_runs/68509c3d71dcf475c816117b0b4130f9547cab8b/reports ``` This link is safe to delete at this point, it gets recreated later. I fixed this by substituting `safe_rmtree` for `shutil.rmtree` and adding symlink awareness into that library call Testing Done: CI running at https://travis-ci.org/pantsbuild/pants/builds/168062004 Tested locally and the symlink is recreated and the HTML report is still available. Bugs closed: 3974 Reviewed at https://rbcommons.com/s/twitter/r/4319/
- Loading branch information