diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2020-11-20 12:22:47 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-20 11:22:47 -0600 |
| commit | 2b85c4d9156ab4bd44e55b2843bd1233a7a5d9ef (patch) | |
| tree | 02458739fa05030014d107b1383273a9a03e2e26 /tests | |
| parent | fd582e8913a4c061ea35025a528331f9ac851651 (diff) | |
| download | cryptography-2b85c4d9156ab4bd44e55b2843bd1233a7a5d9ef.tar.gz | |
Simplify wycheproof pytest code (#5579)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/conftest.py | 4 | ||||
| -rw-r--r-- | tests/utils.py | 7 | ||||
| -rw-r--r-- | tests/wycheproof/test_utils.py | 11 |
3 files changed, 2 insertions, 20 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index 4e3124fa7..ece7a11e7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -11,7 +11,6 @@ from cryptography.hazmat.backends.openssl import backend as openssl_backend from .utils import ( check_backend_support, load_wycheproof_tests, - skip_if_wycheproof_none, ) @@ -30,8 +29,7 @@ def pytest_addoption(parser): def pytest_generate_tests(metafunc): if "wycheproof" in metafunc.fixturenames: - wycheproof = metafunc.config.getoption("--wycheproof-root") - skip_if_wycheproof_none(wycheproof) + wycheproof = metafunc.config.getoption("--wycheproof-root", skip=True) testcases = [] marker = metafunc.definition.get_closest_marker("wycheproof_tests") diff --git a/tests/utils.py b/tests/utils.py index 5d98af00e..497fde83f 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -906,13 +906,6 @@ class WycheproofTest(object): return flag in self.testcase["flags"] -def skip_if_wycheproof_none(wycheproof): - # This is factored into its own function so we can easily test both - # branches - if wycheproof is None: - pytest.skip("--wycheproof-root not provided") - - def load_wycheproof_tests(wycheproof, test_file): path = os.path.join(wycheproof, "testvectors", test_file) with open(path) as f: diff --git a/tests/wycheproof/test_utils.py b/tests/wycheproof/test_utils.py index 2cf3be08e..593d26bde 100644 --- a/tests/wycheproof/test_utils.py +++ b/tests/wycheproof/test_utils.py @@ -4,18 +4,9 @@ from __future__ import absolute_import, division, print_function -import pytest - -from ..utils import WycheproofTest, skip_if_wycheproof_none +from ..utils import WycheproofTest def test_wycheproof_test_repr(): wycheproof = WycheproofTest({}, {}, {"tcId": 3}) assert repr(wycheproof) == "<WycheproofTest({}, {}, {'tcId': 3}, tcId=3)>" - - -def test_skip_if_wycheproof_none(): - with pytest.raises(pytest.skip.Exception): - skip_if_wycheproof_none(None) - - skip_if_wycheproof_none("abc") |
