attempt to clean local directory before setting up test files #510
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently in some situations (such as when an autotest worker is unexpectedly killed), files can fail to be cleaned up at the end of a test run. This can result in subsequent test runs reporting an error like
[Errno 1] Operation not permitted: '/home/docker/.autotesting/workers/autotst0/__pycache__'
However, the files are still cleaned up at the end of the test run, so subsequent test runs do not return this error.
This PR adds an attempt to clear the worker directory before setting up the assignment's files, in case there are leftover files from a previous test run.
Steps to reproduce the behavior locally:
sudo -u autotst0 -- mkdir autotst0/__pycache__
sudo -u autotst0 -- touch autotst0/__pycache__/test.txt
sudo -u autotst0 -- chmod a-rx autotst0/__pycache__/
sudo -u autotst0 -- chmod u+rx autotst0/__pycache__/
I added one test, but note that it is largely redundant with Donny's