Skip to content

Commit 7c771de

Browse files
authored
Type check all tests except test_ssl.py (#1402)
1 parent 02eda54 commit 7c771de

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

tests/test_debug.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from OpenSSL.debug import _env_info
33

44

5-
def test_debug_info():
5+
def test_debug_info() -> None:
66
"""
77
Debug info contains correct data.
88
"""

tests/test_rand.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,30 @@
55
Unit tests for `OpenSSL.rand`.
66
"""
77

8+
from __future__ import annotations
9+
810
import pytest
911

1012
from OpenSSL import rand
1113

1214

1315
class TestRand:
1416
@pytest.mark.parametrize("args", [(b"foo", None), (None, 3)])
15-
def test_add_wrong_args(self, args):
17+
def test_add_wrong_args(self, args: tuple[object, object]) -> None:
1618
"""
1719
`OpenSSL.rand.add` raises `TypeError` if called with arguments not of
1820
type `str` and `int`.
1921
"""
2022
with pytest.raises(TypeError):
21-
rand.add(*args)
23+
rand.add(*args) # type: ignore[arg-type]
2224

23-
def test_add(self):
25+
def test_add(self) -> None:
2426
"""
2527
`OpenSSL.rand.add` adds entropy to the PRNG.
2628
"""
2729
rand.add(b"hamburger", 3)
2830

29-
def test_status(self):
31+
def test_status(self) -> None:
3032
"""
3133
`OpenSSL.rand.status` returns `1` if the PRNG has sufficient entropy,
3234
`0` otherwise.

tests/test_util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class TestErrors:
88
Tests for handling of certain OpenSSL error cases.
99
"""
1010

11-
def test_exception_from_error_queue_nonexistent_reason(self):
11+
def test_exception_from_error_queue_nonexistent_reason(self) -> None:
1212
"""
1313
:func:`exception_from_error_queue` raises ``ValueError`` when it
1414
encounters an OpenSSL error code which does not have a reason string.

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ extras =
4747
deps =
4848
mypy
4949
commands =
50-
mypy src/ tests/conftest.py tests/test_crypto.py
50+
mypy src/ tests/conftest.py tests/test_crypto.py tests/test_debug.py tests/test_rand.py tests/test_util.py tests/util.py
5151

5252
[testenv:check-manifest]
5353
deps =

0 commit comments

Comments
 (0)