test-runner: only remove /tmp files if they exist

This bit of code was throwing exceptions if a test cleaned up files that
test-runner was expecting to clean up. Specifically testHotspot swaps out
main.conf and PSK files many times. This led to the exception being thrown,
caught, and ignored but further on test-runner would print:

"File _X_ not cleaned up!"

Now the files will be checked if they exist before trying to remove it.
This commit is contained in:
James Prestwood 2022-06-03 10:05:54 -07:00 committed by Denis Kenzior
parent 0545dbcf24
commit c36f94a15a
1 changed files with 1 additions and 1 deletions

View File

@ -863,7 +863,7 @@ def post_test(ctx, to_copy):
for f in to_copy:
if os.path.isdir('/tmp/' + f):
shutil.rmtree('/tmp/' + f)
else:
elif os.path.exists('/tmp/' + f):
os.remove('/tmp/' + f)
Process(['ip', 'link', 'set', 'lo', 'down']).wait()