Skip to content

Commit

Permalink
adapted test cleanup to check if file exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Christina Bukas committed Feb 26, 2024
1 parent d75d5fa commit e8c05ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/client/test/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def test_run_inference_run(app):
"--reload",
"--port=7010",
]
print("Going to start subprocess!")
process = subprocess.Popen(command, stdin=subprocess.PIPE, shell=False)
# and wait until it is setup
if sys.platform == 'win32' or sys.platform == 'cygwin': time.sleep(240)
Expand Down
21 changes: 10 additions & 11 deletions src/client/test/test_main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,13 @@ def cleanup_files(request):
# This code runs after all tests from all files have completed
yield
# Clean up
for fname in os.listdir('train_data_path'):
os.remove(os.path.join('train_data_path', fname))
os.rmdir('train_data_path')

for fname in os.listdir('in_prog'):
os.remove(os.path.join('in_prog', fname))
os.rmdir('in_prog')

for fname in os.listdir('eval_data_path'):
os.remove(os.path.join('eval_data_path', fname))
os.rmdir('eval_data_path')
paths_to_clean = ['train_data_path', 'in_prog', 'eval_data_path']
for path in paths_to_clean:
try:
for fname in os.listdir(path):
os.remove(os.path.join(path, fname))
os.rmdir(path)
except FileNotFoundError: pass
except Exception as e:

Check warning on line 168 in src/client/test/test_main_window.py

View check run for this annotation

Codecov / codecov/patch

src/client/test/test_main_window.py#L167-L168

Added lines #L167 - L168 were not covered by tests
# Handle other exceptions
print(f"An error occurred while cleaning up {path}: {e}")

Check warning on line 170 in src/client/test/test_main_window.py

View check run for this annotation

Codecov / codecov/patch

src/client/test/test_main_window.py#L170

Added line #L170 was not covered by tests

0 comments on commit e8c05ab

Please sign in to comment.