Skip to content

Commit

Permalink
tests: Kill processes before deleting temp files
Browse files Browse the repository at this point in the history
These tests seem to try to remove temp files before the processes
using those files had stopped. This likely lead to an error (and
dangling temp files) on Windows, but Modified_Testcase hides the error

Make sure temp directories are removed as the last thing in teardown.

Signed-off-by: Jussi Kukkonen <[email protected]>
  • Loading branch information
Jussi Kukkonen committed Apr 12, 2021
1 parent 441a4fa commit 1902975
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions tests/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,14 @@ def setUp(self):

# Stop server process and perform clean up.
def tearDown(self):
unittest_toolbox.Modified_TestCase.tearDown(self)

# Cleans the resources and flush the logged lines (if any).
self.server_process_handler.clean()

self.target_fileobj.close()

# Remove temp directory
unittest_toolbox.Modified_TestCase.tearDown(self)


# Test: Normal case.
def test_download_url_to_tempfileobj(self):
Expand Down
5 changes: 3 additions & 2 deletions tests/test_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ def setUp(self):

# Stop server process and perform clean up.
def tearDown(self):
unittest_toolbox.Modified_TestCase.tearDown(self)

# Cleans the resources and flush the logged lines (if any).
self.server_process_handler.clean()

self.target_fileobj.close()
self.temp_file.close()

# Remove temporary directory
unittest_toolbox.Modified_TestCase.tearDown(self)


# Test: Normal case.
def test_fetch(self):
Expand Down

0 comments on commit 1902975

Please sign in to comment.