Skip to content

Commit 02cc683

Browse files
authored
Merge pull request #313 from tlsfuzzer/ci-updates
Ci updates
2 parents 644412d + cc26d74 commit 02cc683

File tree

11 files changed

+62
-98
lines changed

11 files changed

+62
-98
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,43 +24,35 @@ jobs:
2424
python-version: "3.10"
2525
tox-env: py310
2626
- name: py2.7
27-
os: ubuntu-18.04
27+
os: ubuntu-20.04
2828
python-version: 2.7
2929
tox-env: py27
3030
- name: py2.7 with old gmpy
31-
os: ubuntu-18.04
31+
os: ubuntu-20.04
3232
python-version: 2.7
3333
tox-env: py27_old_gmpy
3434
- name: py2.7 with old gmpy2
35-
os: ubuntu-18.04
35+
os: ubuntu-20.04
3636
python-version: 2.7
3737
tox-env: py27_old_gmpy2
3838
- name: py2.7 with old six
39-
os: ubuntu-18.04
39+
os: ubuntu-20.04
4040
python-version: 2.7
4141
tox-env: py27_old_six
4242
- name: py2.7 with gmpy
43-
os: ubuntu-18.04
43+
os: ubuntu-20.04
4444
python-version: 2.7
4545
tox-env: gmpypy27
4646
- name: py2.7 with gmpy2
47-
os: ubuntu-18.04
47+
os: ubuntu-20.04
4848
python-version: 2.7
4949
tox-env: gmpy2py27
50-
- name: py3.3
51-
os: ubuntu-18.04
52-
python-version: 3.3
53-
tox-env: py33
54-
- name: py3.4
55-
os: ubuntu-18.04
56-
python-version: 3.4
57-
tox-env: py34
5850
- name: py3.5
59-
os: ubuntu-18.04
51+
os: ubuntu-20.04
6052
python-version: 3.5
6153
tox-env: py35
6254
- name: py3.6
63-
os: ubuntu-18.04
55+
os: ubuntu-20.04
6456
python-version: 3.6
6557
tox-env: py36
6658
- name: py3.7
@@ -89,8 +81,12 @@ jobs:
8981
tox-env: gmpy2py310
9082
- name: py3.11
9183
os: ubuntu-latest
92-
python-version: '3.11.0-beta.3'
84+
python-version: '3.11'
9385
tox-env: py311
86+
- name: py3.12
87+
os: ubuntu-latest
88+
python-version: '3.12.0-alpha.5'
89+
tox-env: py312
9490
- name: pypy
9591
os: ubuntu-latest
9692
python-version: pypy-2.7
@@ -101,7 +97,7 @@ jobs:
10197
tox-env: pypy3
10298
# special configurations
10399
- name: py2.7 with instrumental
104-
os: ubuntu-18.04
100+
os: ubuntu-20.04
105101
python-version: 2.7
106102
opt-deps: ['instrumental']
107103
- name: code checks

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ curves over prime fields.
4545
## Dependencies
4646

4747
This library uses only Python and the 'six' package. It is compatible with
48-
Python 2.6, 2.7, and 3.3+. It also supports execution on alternative
48+
Python 2.6, 2.7, and 3.5+. It also supports execution on alternative
4949
implementations like pypy and pypy3.
5050

5151
If `gmpy2` or `gmpy` is installed, they will be used for faster arithmetic.

build-requirements-3.3.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.

build-requirements-3.4.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,21 @@
2727
package_dir={"": "src"},
2828
license="MIT",
2929
cmdclass=commands,
30-
python_requires=">=2.6, !=3.0.*, !=3.1.*, !=3.2.*",
30+
python_requires=">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
3131
classifiers=[
3232
"Programming Language :: Python",
3333
"Programming Language :: Python :: 2",
3434
"Programming Language :: Python :: 2.6",
3535
"Programming Language :: Python :: 2.7",
3636
"Programming Language :: Python :: 3",
37-
"Programming Language :: Python :: 3.3",
38-
"Programming Language :: Python :: 3.4",
3937
"Programming Language :: Python :: 3.5",
4038
"Programming Language :: Python :: 3.6",
4139
"Programming Language :: Python :: 3.7",
4240
"Programming Language :: Python :: 3.8",
4341
"Programming Language :: Python :: 3.9",
4442
"Programming Language :: Python :: 3.10",
4543
"Programming Language :: Python :: 3.11",
44+
"Programming Language :: Python :: 3.12",
4645
],
4746
install_requires=["six>=1.9.0"],
4847
extras_require={"gmpy2": "gmpy2", "gmpy": "gmpy"},

src/ecdsa/_compat.py

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -91,28 +91,13 @@ def int_to_bytes(val, length=None, byteorder="big"):
9191
raise ValueError("Only 'big' or 'little' endian supported")
9292

9393
else:
94-
if sys.version_info < (3, 4): # pragma: no branch
95-
# on python 3.3 hmac.hmac.update() accepts only bytes, on newer
96-
# versions it does accept memoryview() also
97-
def hmac_compat(data):
98-
if not isinstance(data, bytes): # pragma: no branch
99-
return bytes(data)
100-
return data
101-
102-
def normalise_bytes(buffer_object):
103-
"""Cast the input into array of bytes."""
104-
if not buffer_object:
105-
return b""
106-
return memoryview(buffer_object).cast("B")
10794

108-
else:
109-
110-
def hmac_compat(data):
111-
return data
95+
def hmac_compat(data):
96+
return data
11297

113-
def normalise_bytes(buffer_object):
114-
"""Cast the input into array of bytes."""
115-
return memoryview(buffer_object).cast("B")
98+
def normalise_bytes(buffer_object):
99+
"""Cast the input into array of bytes."""
100+
return memoryview(buffer_object).cast("B")
116101

117102
def compat26_str(val):
118103
return val

src/ecdsa/test_der.py

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -144,26 +144,22 @@ def test_old_call_convention(self):
144144

145145
def test_new_call_convention(self):
146146
"""This is how it should be called now."""
147-
warnings.simplefilter("always")
148-
with pytest.warns(None) as warns:
147+
# make sure no warnings are raised
148+
with warnings.catch_warnings():
149+
warnings.simplefilter("error")
149150
der = encode_bitstring(b"\xff", 0)
150151

151-
# verify that new call convention doesn't raise Warnings
152-
self.assertEqual(len(warns), 0)
153-
154152
self.assertEqual(der, b"\x03\x02\x00\xff")
155153

156154
def test_implicit_unused_bits(self):
157155
"""
158156
Writing bit string with already included the number of unused bits.
159157
"""
160-
warnings.simplefilter("always")
161-
with pytest.warns(None) as warns:
158+
# make sure no warnings are raised
159+
with warnings.catch_warnings():
160+
warnings.simplefilter("error")
162161
der = encode_bitstring(b"\x00\xff", None)
163162

164-
# verify that new call convention doesn't raise Warnings
165-
self.assertEqual(len(warns), 0)
166-
167163
self.assertEqual(der, b"\x03\x02\x00\xff")
168164

169165
def test_explicit_unused_bits(self):
@@ -203,22 +199,20 @@ def test_old_call_convention(self):
203199
self.assertEqual(rest, b"")
204200

205201
def test_new_call_convention(self):
206-
warnings.simplefilter("always")
207-
with pytest.warns(None) as warns:
202+
# make sure no warnings are raised
203+
with warnings.catch_warnings():
204+
warnings.simplefilter("error")
208205
bits, rest = remove_bitstring(b"\x03\x02\x00\xff", 0)
209206

210-
self.assertEqual(len(warns), 0)
211-
212207
self.assertEqual(bits, b"\xff")
213208
self.assertEqual(rest, b"")
214209

215210
def test_implicit_unexpected_unused(self):
216-
warnings.simplefilter("always")
217-
with pytest.warns(None) as warns:
211+
# make sure no warnings are raised
212+
with warnings.catch_warnings():
213+
warnings.simplefilter("error")
218214
bits, rest = remove_bitstring(b"\x03\x02\x00\xff", None)
219215

220-
self.assertEqual(len(warns), 0)
221-
222216
self.assertEqual(bits, (b"\xff", 0))
223217
self.assertEqual(rest, b"")
224218

src/ecdsa/test_jacobi.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_add_with_different_curves(self):
5050
p_a = PointJacobi.from_affine(generator_256)
5151
p_b = PointJacobi.from_affine(generator_224)
5252

53-
with self.assertRaises(ValueError):
53+
with self.assertRaises(ValueError): # pragma: no branch
5454
p_a + p_b
5555

5656
def test_compare_different_curves(self):
@@ -558,8 +558,12 @@ def test_pickle(self):
558558
self.assertEqual(pickle.loads(pickle.dumps(pj)), pj)
559559

560560
@settings(**NO_OLD_SETTINGS)
561+
@pytest.mark.skipif(
562+
platform.python_implementation() == "PyPy",
563+
reason="threading on PyPy breaks coverage",
564+
)
561565
@given(st.integers(min_value=1, max_value=10))
562-
def test_multithreading(self, thread_num):
566+
def test_multithreading(self, thread_num): # pragma: no cover
563567
# ensure that generator's precomputation table is filled
564568
generator_112r2 * 2
565569

@@ -592,10 +596,12 @@ def runner(generator):
592596
)
593597

594598
@pytest.mark.skipif(
595-
platform.system() == "Windows",
596-
reason="there are no signals on Windows",
599+
platform.system() == "Windows"
600+
or platform.python_implementation() == "PyPy",
601+
reason="there are no signals on Windows, and threading breaks coverage"
602+
" on PyPy",
597603
)
598-
def test_multithreading_with_interrupts(self):
604+
def test_multithreading_with_interrupts(self): # pragma: no cover
599605
thread_num = 10
600606
# ensure that generator's precomputation table is filled
601607
generator_112r2 * 2

src/ecdsa/test_numbertheory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def st_comp_with_com_fac(draw):
182182
# select at most 20 lists (returned numbers),
183183
# each having at most 30 primes (factors) including none (then the number
184184
# will be 1)
185-
comp_primes = draw(
185+
comp_primes = draw( # pragma: no branch
186186
st.integers(min_value=1, max_value=20).flatmap(
187187
lambda n: st.lists(
188188
st.lists(st.sampled_from(primes), max_size=30),
@@ -225,7 +225,7 @@ def st_comp_no_com_fac(draw):
225225

226226
# select at most 20 lists, each having at most 30 primes
227227
# selected from the leftover_primes list
228-
number_primes = draw(
228+
number_primes = draw( # pragma: no branch
229229
st.integers(min_value=1, max_value=20).flatmap(
230230
lambda n: st.lists(
231231
st.lists(st.sampled_from(leftover_primes), max_size=30),

src/ecdsa/test_pyecdsa.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,12 +1359,12 @@ def do_test_to_openssl(self, curve, hash_name="SHA1"):
13591359
OPENSSL_SUPPORTED_TYPES = set()
13601360
try:
13611361
if "-rawin" in run_openssl("pkeyutl -help"):
1362-
OPENSSL_SUPPORTED_TYPES = set(
1362+
OPENSSL_SUPPORTED_TYPES = set( # pragma: no branch
13631363
c.lower()
13641364
for c in ("ED25519", "ED448")
13651365
if c in run_openssl("list -public-key-methods")
13661366
)
1367-
except SubprocessError:
1367+
except SubprocessError: # pragma: no cover
13681368
pass
13691369

13701370
def do_eddsa_test_to_openssl(self, curve):

0 commit comments

Comments
 (0)