forked from theupdateframework/python-tuf
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: stop using unittest_toolbox in new tests
Update new test modules to stop using unittest_toolbox, in preparation for its removal in theupdateframework#1790. The tools provided by unittest_toolbox can easily (in a more obvious way) be replaced by using the standard library modules `tempfile` and `random` (no more used) directly. In the case of tempdir and -file creation/removal, skipping the use of unittest_toolbox, which does this by default, also uncovers some test cleanup failures, which would occur when temporary test directories were removed while a test server hadn't released them. (see `except OSError: pass` in unittest_toolbox's `tearDown` method) **Change details** **test_fetcher_ng.py:** - Stop implicitly creating (setUp) and removing (tearDown) tmp test dirs. -Move now manual creation of an exemplary targets file to setUpClass, as the same file is used by all tests. And remove it explicitly in tearDownClass after killing the server (see note about failure above). - Trigger URL parsing error with a hardcoded invalid URL string instead of a random string. **test_updater_ng.py** - Stop implicitly creating (setUp) and removing (tearDown) tmp test dirs. - Explicitly create tmp test dirs in setUp, but don't remove them in tearDown to avoid above mentioned failures. They will be removed all at once when removing the tmp root test dir in tearDownClass Signed-off-by: Lukas Puehringer <[email protected]>
- Loading branch information
Showing
3 changed files
with
45 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters