diff options
author | Stephen Finucane <stephenfin@redhat.com> | 2021-11-11 18:52:41 +0000 |
---|---|---|
committer | Stephen Finucane <stephenfin@redhat.com> | 2021-11-11 19:27:51 +0000 |
commit | e28afc564700a1a35e3bf0269687d5734251b88a (patch) | |
tree | e5e9002f7ba4d05454780a74f41fe37226ff2924 /tox.ini | |
parent | 79436a84ccf13bd45e5950343cae2e8def8b4e86 (diff) | |
download | nova-e28afc564700a1a35e3bf0269687d5734251b88a.tar.gz |
tests: Restore - don't reset - warning filters
There are more various warning filters pre-configured in a typical
Python environment, including a few from third-party libraries such as
requests [1][2] and urllib3 [3] as well as stdlib [4]. Our fixture to
configure warnings, 'WarningsFixture', called 'warnings.resetwarnings'
which *reset* all the warning filters [5]. This is clearly not something
we want to do, and resulted in tests puking warnings after the initial
test run.
Resolve this by backing up the existing warning filters before applying
the filter, and then *restoring* this original list of warning filters
after the test run.
[1] https://github.com/psf/requests/blob/v2.26.0/requests/__init__.py#L127
[2] https://github.com/psf/requests/blob/v2.26.0/requests/__init__.py#L152
[3] https://github.com/urllib3/urllib3/blob/1.26.7/src/urllib3/__init__.py#L68-L78
[4] https://docs.python.org/3.8/library/warnings.html#default-warning-filter
[5] https://docs.python.org/3.8/library/warnings.html#warnings.resetwarnings
Change-Id: I63f57980e01f472a25821790610f0836f1882a7f
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Diffstat (limited to 'tox.ini')
0 files changed, 0 insertions, 0 deletions