Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exclude invalid exceptions from filterwarnings
Ref #355
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""Local pytest plugin. | ||
Contains hooks, which are tightly bound to the Cheroot framework | ||
itself, useless for end-users' app testing. | ||
""" | ||
|
||
from __future__ import absolute_import, division, print_function | ||
__metaclass__ = type | ||
|
||
from pytest import __version__ | ||
|
||
|
||
pytest_version = tuple(map(int, __version__.split('.'))) | ||
unraisable_exceptions = { | ||
('pytest', 'PytestUnhandledThreadExceptionWarning'), | ||
('pytest', 'PytestUnraisableExceptionWarning'), | ||
} | ||
|
||
|
||
def pytest_load_initial_conftests(early_config, parser, args): | ||
"""Drop unfilterable warning ignores.""" | ||
if pytest_version >= (6, 2, 0): | ||
return | ||
|
||
early_config._inicache['filterwarnings'] = [ | ||
fw for fw in early_config.getini('filterwarnings') | ||
if fw.count(':') < 2 or | ||
tuple(fw.split(':')[2].split('.')[:2]) not in unraisable_exceptions | ||
] |
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