-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
23 lines (18 loc) · 801 Bytes
/
Copy pathconftest.py
File metadata and controls
23 lines (18 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Session-wide pytest setup.
One thing only: silence `cw.compat`'s deprecation warnings for the run. `cw/compat.py`'s
doctests exercise the shim, and every one of them correctly fires a `DeprecationWarning` --
which is the module working, not a problem, but sixty-odd of them bury anything that is a
problem. `tests/test_compat.py::TestDeprecation` unsets this and asserts the warnings really
do fire, so silencing them here costs no coverage of the behaviour.
"""
import os
import pytest
@pytest.fixture(scope="session", autouse=True)
def _quiet_compat_deprecations():
before = os.environ.get("CW_COMPAT_QUIET")
os.environ["CW_COMPAT_QUIET"] = "1"
yield
if before is None:
os.environ.pop("CW_COMPAT_QUIET", None)
else:
os.environ["CW_COMPAT_QUIET"] = before