You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ju...@apache.org on 2021/10/24 19:05:10 UTC
[buildstream] 01/01: testing/integration.py: Make integration cache
cleanup more robust
This is an automated email from the ASF dual-hosted git repository.
juergbi pushed a commit to branch juerg/integration-cache
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit bdf9c72e1bb2b0eeaa9db79126857133e7b53d8d
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Sun Oct 24 20:34:08 2021 +0200
testing/integration.py: Make integration cache cleanup more robust
We already ignore FileNotFoundError during integration cache cleanup.
However, the approach with a dummy except clause results in `rmtree()`
aborting on the first error. Use `ignore_errors=True` to try and remove
as many files and directories as possible instead of aborting on the
first error.
---
src/buildstream/testing/integration.py | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/src/buildstream/testing/integration.py b/src/buildstream/testing/integration.py
index 269b3d3..662111d 100644
--- a/src/buildstream/testing/integration.py
+++ b/src/buildstream/testing/integration.py
@@ -103,11 +103,5 @@ def integration_cache(request):
# Clean up the artifacts after each test session - we only want to
# cache sources between tests
- try:
- shutil.rmtree(cache.cachedir)
- except FileNotFoundError:
- pass
- try:
- shutil.rmtree(os.path.join(cache.root, "cas"))
- except FileNotFoundError:
- pass
+ shutil.rmtree(cache.cachedir, ignore_errors=True)
+ shutil.rmtree(os.path.join(cache.root, "cas"), ignore_errors=True)