diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2022-06-09 11:15:04 -0700 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2022-06-15 11:42:02 -0700 |
commit | c6597ac89f3690a44df27fb71885fc1490e82be5 (patch) | |
tree | f8b35853f89c8556ae47794b5ed37a957dc0bf04 /numpy/conftest.py | |
parent | f0a1af6e3dcc080dc5c120fc99b261b237bbd66c (diff) | |
download | numpy-c6597ac89f3690a44df27fb71885fc1490e82be5.tar.gz |
TST: Improve testing setup by introducing a new `weak_promotion` fixture
Unfortunately, this shows that the rational tests are still broken a bit.
Diffstat (limited to 'numpy/conftest.py')
-rw-r--r-- | numpy/conftest.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/numpy/conftest.py b/numpy/conftest.py index fd5fdd77d..8aa6587ee 100644 --- a/numpy/conftest.py +++ b/numpy/conftest.py @@ -117,3 +117,20 @@ def add_np(doctest_namespace): @pytest.fixture(autouse=True) def env_setup(monkeypatch): monkeypatch.setenv('PYTHONHASHSEED', '0') + + +@pytest.fixture(params=[True, False]) +def weak_promotion(request): + """ + Fixture to ensure "legacy" promotion state or change it to use the new + weak promotion (plus warning). `old_promotion` should be used as a + parameter in the function. + """ + state = numpy._get_promotion_state() + if request.param: + numpy._set_promotion_state("weak_and_warn") + else: + numpy._set_promotion_state("legacy") + + yield request.param + numpy._set_promotion_state(state) |