Skip to content

Commit 1b1d3f9

Browse files
committed
add mark @slow to allow skipping slowest tests
as calling openssl is very slow, allow skipping tests that do that
1 parent 6d976f2 commit 1b1d3f9

File tree

5 files changed

+42
-2
lines changed

5 files changed

+42
-2
lines changed

conftest.py

+7
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,10 @@ def pytest_addoption(parser):
44
parser.addoption(
55
"--fast", action="store_true", default=False, help="run tests fast"
66
)
7+
8+
9+
def pytest_configure(config):
10+
config.addinivalue_line(
11+
"markers",
12+
"slow: mark test as slow to run (deselect with '-m \"not slow\"')"
13+
)

cosmic-ray.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module-path = "src"
33
python-version = ""
44
timeout = 30.0
55
exclude-modules = ['src/ecdsa/_version.py', 'src/ecdsa/test*']
6-
test-command = "pytest -x --fast src/"
6+
test-command = "pytest -x --fast -m 'not slow' src/"
77

88
[cosmic-ray.execution-engine]
99
name = "local"

src/ecdsa/test_ecdh.py

+1
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ def run_openssl(cmd):
292292
)
293293

294294

295+
@pytest.mark.slow
295296
@pytest.mark.parametrize(
296297
"vcurve", curves, ids=[curve.name for curve in curves]
297298
)

src/ecdsa/test_jacobi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def test_add_same_scale_points(self, a_mul, b_mul, new_z):
311311

312312
self.assertEqual(c, j_g * (a_mul + b_mul))
313313

314-
@settings(max_examples=14)
314+
@settings(max_examples=10)
315315
@given(
316316
st.integers(
317317
min_value=1, max_value=int(generator_brainpoolp160r1.order())

src/ecdsa/test_pyecdsa.py

+32
Original file line numberDiff line numberDiff line change
@@ -873,111 +873,127 @@ def get_openssl_messagedigest_arg(self, hash_name):
873873
# vk: 3:OpenSSL->python 4:python->OpenSSL
874874
# sig: 5:OpenSSL->python 6:python->OpenSSL
875875

876+
@pytest.mark.slow
876877
@pytest.mark.skipif(
877878
"prime192v1" not in OPENSSL_SUPPORTED_CURVES,
878879
reason="system openssl does not support prime192v1",
879880
)
880881
def test_from_openssl_nist192p(self):
881882
return self.do_test_from_openssl(NIST192p)
882883

884+
@pytest.mark.slow
883885
@pytest.mark.skipif(
884886
"prime192v1" not in OPENSSL_SUPPORTED_CURVES,
885887
reason="system openssl does not support prime192v1",
886888
)
887889
def test_from_openssl_nist192p_sha256(self):
888890
return self.do_test_from_openssl(NIST192p, "SHA256")
889891

892+
@pytest.mark.slow
890893
@pytest.mark.skipif(
891894
"secp224r1" not in OPENSSL_SUPPORTED_CURVES,
892895
reason="system openssl does not support secp224r1",
893896
)
894897
def test_from_openssl_nist224p(self):
895898
return self.do_test_from_openssl(NIST224p)
896899

900+
@pytest.mark.slow
897901
@pytest.mark.skipif(
898902
"prime256v1" not in OPENSSL_SUPPORTED_CURVES,
899903
reason="system openssl does not support prime256v1",
900904
)
901905
def test_from_openssl_nist256p(self):
902906
return self.do_test_from_openssl(NIST256p)
903907

908+
@pytest.mark.slow
904909
@pytest.mark.skipif(
905910
"prime256v1" not in OPENSSL_SUPPORTED_CURVES,
906911
reason="system openssl does not support prime256v1",
907912
)
908913
def test_from_openssl_nist256p_sha384(self):
909914
return self.do_test_from_openssl(NIST256p, "SHA384")
910915

916+
@pytest.mark.slow
911917
@pytest.mark.skipif(
912918
"prime256v1" not in OPENSSL_SUPPORTED_CURVES,
913919
reason="system openssl does not support prime256v1",
914920
)
915921
def test_from_openssl_nist256p_sha512(self):
916922
return self.do_test_from_openssl(NIST256p, "SHA512")
917923

924+
@pytest.mark.slow
918925
@pytest.mark.skipif(
919926
"secp384r1" not in OPENSSL_SUPPORTED_CURVES,
920927
reason="system openssl does not support secp384r1",
921928
)
922929
def test_from_openssl_nist384p(self):
923930
return self.do_test_from_openssl(NIST384p)
924931

932+
@pytest.mark.slow
925933
@pytest.mark.skipif(
926934
"secp521r1" not in OPENSSL_SUPPORTED_CURVES,
927935
reason="system openssl does not support secp521r1",
928936
)
929937
def test_from_openssl_nist521p(self):
930938
return self.do_test_from_openssl(NIST521p)
931939

940+
@pytest.mark.slow
932941
@pytest.mark.skipif(
933942
"secp256k1" not in OPENSSL_SUPPORTED_CURVES,
934943
reason="system openssl does not support secp256k1",
935944
)
936945
def test_from_openssl_secp256k1(self):
937946
return self.do_test_from_openssl(SECP256k1)
938947

948+
@pytest.mark.slow
939949
@pytest.mark.skipif(
940950
"brainpoolP160r1" not in OPENSSL_SUPPORTED_CURVES,
941951
reason="system openssl does not support brainpoolP160r1",
942952
)
943953
def test_from_openssl_brainpoolp160r1(self):
944954
return self.do_test_from_openssl(BRAINPOOLP160r1)
945955

956+
@pytest.mark.slow
946957
@pytest.mark.skipif(
947958
"brainpoolP192r1" not in OPENSSL_SUPPORTED_CURVES,
948959
reason="system openssl does not support brainpoolP192r1",
949960
)
950961
def test_from_openssl_brainpoolp192r1(self):
951962
return self.do_test_from_openssl(BRAINPOOLP192r1)
952963

964+
@pytest.mark.slow
953965
@pytest.mark.skipif(
954966
"brainpoolP224r1" not in OPENSSL_SUPPORTED_CURVES,
955967
reason="system openssl does not support brainpoolP224r1",
956968
)
957969
def test_from_openssl_brainpoolp224r1(self):
958970
return self.do_test_from_openssl(BRAINPOOLP224r1)
959971

972+
@pytest.mark.slow
960973
@pytest.mark.skipif(
961974
"brainpoolP256r1" not in OPENSSL_SUPPORTED_CURVES,
962975
reason="system openssl does not support brainpoolP256r1",
963976
)
964977
def test_from_openssl_brainpoolp256r1(self):
965978
return self.do_test_from_openssl(BRAINPOOLP256r1)
966979

980+
@pytest.mark.slow
967981
@pytest.mark.skipif(
968982
"brainpoolP320r1" not in OPENSSL_SUPPORTED_CURVES,
969983
reason="system openssl does not support brainpoolP320r1",
970984
)
971985
def test_from_openssl_brainpoolp320r1(self):
972986
return self.do_test_from_openssl(BRAINPOOLP320r1)
973987

988+
@pytest.mark.slow
974989
@pytest.mark.skipif(
975990
"brainpoolP384r1" not in OPENSSL_SUPPORTED_CURVES,
976991
reason="system openssl does not support brainpoolP384r1",
977992
)
978993
def test_from_openssl_brainpoolp384r1(self):
979994
return self.do_test_from_openssl(BRAINPOOLP384r1)
980995

996+
@pytest.mark.slow
981997
@pytest.mark.skipif(
982998
"brainpoolP512r1" not in OPENSSL_SUPPORTED_CURVES,
983999
reason="system openssl does not support brainpoolP512r1",
@@ -1037,111 +1053,127 @@ def do_test_from_openssl(self, curve, hash_name="SHA1"):
10371053
sk_from_p8 = SigningKey.from_pem(privkey_p8_pem)
10381054
self.assertEqual(sk, sk_from_p8)
10391055

1056+
@pytest.mark.slow
10401057
@pytest.mark.skipif(
10411058
"prime192v1" not in OPENSSL_SUPPORTED_CURVES,
10421059
reason="system openssl does not support prime192v1",
10431060
)
10441061
def test_to_openssl_nist192p(self):
10451062
self.do_test_to_openssl(NIST192p)
10461063

1064+
@pytest.mark.slow
10471065
@pytest.mark.skipif(
10481066
"prime192v1" not in OPENSSL_SUPPORTED_CURVES,
10491067
reason="system openssl does not support prime192v1",
10501068
)
10511069
def test_to_openssl_nist192p_sha256(self):
10521070
self.do_test_to_openssl(NIST192p, "SHA256")
10531071

1072+
@pytest.mark.slow
10541073
@pytest.mark.skipif(
10551074
"secp224r1" not in OPENSSL_SUPPORTED_CURVES,
10561075
reason="system openssl does not support secp224r1",
10571076
)
10581077
def test_to_openssl_nist224p(self):
10591078
self.do_test_to_openssl(NIST224p)
10601079

1080+
@pytest.mark.slow
10611081
@pytest.mark.skipif(
10621082
"prime256v1" not in OPENSSL_SUPPORTED_CURVES,
10631083
reason="system openssl does not support prime256v1",
10641084
)
10651085
def test_to_openssl_nist256p(self):
10661086
self.do_test_to_openssl(NIST256p)
10671087

1088+
@pytest.mark.slow
10681089
@pytest.mark.skipif(
10691090
"prime256v1" not in OPENSSL_SUPPORTED_CURVES,
10701091
reason="system openssl does not support prime256v1",
10711092
)
10721093
def test_to_openssl_nist256p_sha384(self):
10731094
self.do_test_to_openssl(NIST256p, "SHA384")
10741095

1096+
@pytest.mark.slow
10751097
@pytest.mark.skipif(
10761098
"prime256v1" not in OPENSSL_SUPPORTED_CURVES,
10771099
reason="system openssl does not support prime256v1",
10781100
)
10791101
def test_to_openssl_nist256p_sha512(self):
10801102
self.do_test_to_openssl(NIST256p, "SHA512")
10811103

1104+
@pytest.mark.slow
10821105
@pytest.mark.skipif(
10831106
"secp384r1" not in OPENSSL_SUPPORTED_CURVES,
10841107
reason="system openssl does not support secp384r1",
10851108
)
10861109
def test_to_openssl_nist384p(self):
10871110
self.do_test_to_openssl(NIST384p)
10881111

1112+
@pytest.mark.slow
10891113
@pytest.mark.skipif(
10901114
"secp521r1" not in OPENSSL_SUPPORTED_CURVES,
10911115
reason="system openssl does not support secp521r1",
10921116
)
10931117
def test_to_openssl_nist521p(self):
10941118
self.do_test_to_openssl(NIST521p)
10951119

1120+
@pytest.mark.slow
10961121
@pytest.mark.skipif(
10971122
"secp256k1" not in OPENSSL_SUPPORTED_CURVES,
10981123
reason="system openssl does not support secp256k1",
10991124
)
11001125
def test_to_openssl_secp256k1(self):
11011126
self.do_test_to_openssl(SECP256k1)
11021127

1128+
@pytest.mark.slow
11031129
@pytest.mark.skipif(
11041130
"brainpoolP160r1" not in OPENSSL_SUPPORTED_CURVES,
11051131
reason="system openssl does not support brainpoolP160r1",
11061132
)
11071133
def test_to_openssl_brainpoolp160r1(self):
11081134
self.do_test_to_openssl(BRAINPOOLP160r1)
11091135

1136+
@pytest.mark.slow
11101137
@pytest.mark.skipif(
11111138
"brainpoolP192r1" not in OPENSSL_SUPPORTED_CURVES,
11121139
reason="system openssl does not support brainpoolP192r1",
11131140
)
11141141
def test_to_openssl_brainpoolp192r1(self):
11151142
self.do_test_to_openssl(BRAINPOOLP192r1)
11161143

1144+
@pytest.mark.slow
11171145
@pytest.mark.skipif(
11181146
"brainpoolP224r1" not in OPENSSL_SUPPORTED_CURVES,
11191147
reason="system openssl does not support brainpoolP224r1",
11201148
)
11211149
def test_to_openssl_brainpoolp224r1(self):
11221150
self.do_test_to_openssl(BRAINPOOLP224r1)
11231151

1152+
@pytest.mark.slow
11241153
@pytest.mark.skipif(
11251154
"brainpoolP256r1" not in OPENSSL_SUPPORTED_CURVES,
11261155
reason="system openssl does not support brainpoolP256r1",
11271156
)
11281157
def test_to_openssl_brainpoolp256r1(self):
11291158
self.do_test_to_openssl(BRAINPOOLP256r1)
11301159

1160+
@pytest.mark.slow
11311161
@pytest.mark.skipif(
11321162
"brainpoolP320r1" not in OPENSSL_SUPPORTED_CURVES,
11331163
reason="system openssl does not support brainpoolP320r1",
11341164
)
11351165
def test_to_openssl_brainpoolp320r1(self):
11361166
self.do_test_to_openssl(BRAINPOOLP320r1)
11371167

1168+
@pytest.mark.slow
11381169
@pytest.mark.skipif(
11391170
"brainpoolP384r1" not in OPENSSL_SUPPORTED_CURVES,
11401171
reason="system openssl does not support brainpoolP384r1",
11411172
)
11421173
def test_to_openssl_brainpoolp384r1(self):
11431174
self.do_test_to_openssl(BRAINPOOLP384r1)
11441175

1176+
@pytest.mark.slow
11451177
@pytest.mark.skipif(
11461178
"brainpoolP512r1" not in OPENSSL_SUPPORTED_CURVES,
11471179
reason="system openssl does not support brainpoolP512r1",

0 commit comments

Comments
 (0)