-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
finalize_teardown
method to clean up if setup
or teardown
fail
If the `setup` or `teardown` methods fail, the tests session waits for timeout (1800s per benchmark!) provided a sub process had been created beforehand. This lead to excruciatingly long test sessions, appearing fully stuck.
- Loading branch information
Showing
3 changed files
with
71 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
# Licensed under a 3-clause BSD style license - see LICENSE.rst | ||
|
||
|
||
class FinalizeTeardownSetupTest: | ||
def setup(self, n): | ||
raise ValueError("Setup fails") | ||
|
||
def time_it(self, n): | ||
pass | ||
|
||
def finalize_teardown(self, exc_type, exc, trace): | ||
assert exc_type == ValueError | ||
assert str(exc) == "Setup fails" | ||
assert trace is not None | ||
|
||
|
||
class FinalizeTeardownTeardownTest: | ||
def teardown(self, n): | ||
raise NotImplementedError("Teardown fails") | ||
|
||
def time_it(self, n): | ||
pass | ||
|
||
def finalize_teardown(self, exc_type, exc, trace): | ||
assert exc_type == NotImplementedError | ||
assert str(exc) == "Teardown fails" | ||
assert trace is not None |