Skip to content

Commit 7848987

Browse files
committed
Simplify the test suite decorators
This change eliminates duplicate instantiation of pytest `skipif()` objects.
1 parent d28dc35 commit 7848987

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

tests/utils.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,13 @@ def key_path(key_name):
1515
return os.path.join(os.path.dirname(os.path.realpath(__file__)), "keys", key_name)
1616

1717

18-
def no_crypto_required(class_or_func):
19-
decorator = pytest.mark.skipif(
20-
has_crypto,
21-
reason="Requires cryptography library not installed",
22-
)
23-
return decorator(class_or_func)
24-
25-
26-
def crypto_required(class_or_func):
27-
decorator = pytest.mark.skipif(
28-
not has_crypto, reason="Requires cryptography library installed"
29-
)
30-
return decorator(class_or_func)
18+
no_crypto_required = pytest.mark.skipif(
19+
has_crypto,
20+
reason="Requires cryptography library not installed",
21+
)
22+
23+
24+
crypto_required = pytest.mark.skipif(
25+
not has_crypto,
26+
reason="Requires cryptography library installed",
27+
)

0 commit comments

Comments
 (0)