diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2023-03-28 22:28:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-29 02:28:17 +0000 |
commit | 22759dbab0bc85da995febcc3e82680fe6b2804a (patch) | |
tree | 237284fa2381e3d0a76bc918d0e41121baecf3ab /tests/conftest.py | |
parent | 59a749333e336b5aa1f9864fe01d67ec11c3a065 (diff) | |
download | pyca-cryptography-22759dbab0bc85da995febcc3e82680fe6b2804a.zip pyca-cryptography-22759dbab0bc85da995febcc3e82680fe6b2804a.tar.gz pyca-cryptography-22759dbab0bc85da995febcc3e82680fe6b2804a.tar.bz2 |
Switch from pytest-subtests to a mini-version that's faster (#8613)
Diffstat (limited to 'tests/conftest.py')
-rw-r--r-- | tests/conftest.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index 51dca19..0e128a1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,6 +2,7 @@ # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. +import contextlib import pytest @@ -46,3 +47,21 @@ def backend(request): # Ensure the error stack is clear after the test errors = openssl_backend._consume_errors() assert not errors + + +@pytest.fixture() +def subtests(): + # This is a miniature version of the pytest-subtests package, but + # optimized for lower overhead. + # + # When tests are skipped, these are not logged in the final pytest output. + yield SubTests() + + +class SubTests: + @contextlib.contextmanager + def test(self): + try: + yield + except pytest.skip.Exception: + pass |