Skip to content

Commit 1fdced6

Browse files
authored
Get far enough that conftest.py type checks (#1398)
1 parent d3621f5 commit 1fdced6

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

pyproject.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@ source = [
1313
]
1414

1515
[tool.coverage.report]
16-
exclude_also = [
17-
"assert False",
18-
]
16+
exclude_also = ["assert False"]
1917
show_missing = true
2018

2119
[tool.mypy]
2220
warn_unused_configs = true
23-
follow_imports = "skip"
2421
strict = true
2522

2623
[[tool.mypy.overrides]]

src/OpenSSL/crypto.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,10 @@ def to_cryptography_key(self) -> _Key:
264264

265265
if self._only_public:
266266
der = dump_publickey(FILETYPE_ASN1, self)
267-
return load_der_public_key(der)
267+
return typing.cast(_Key, load_der_public_key(der))
268268
else:
269269
der = dump_privatekey(FILETYPE_ASN1, self)
270-
return load_der_private_key(der, None)
270+
return typing.cast(_Key, load_der_private_key(der, password=None))
271271

272272
@classmethod
273273
def from_cryptography_key(cls, crypto_key: _Key) -> PKey:

tests/conftest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
import pytest
88

99

10-
def pytest_report_header(config):
10+
def pytest_report_header(config: pytest.Config) -> str:
1111
import cryptography
1212

1313
import OpenSSL.SSL
1414

1515
return (
16-
f"OpenSSL: {OpenSSL.SSL.SSLeay_version(OpenSSL.SSL.SSLEAY_VERSION)}\n"
16+
f"OpenSSL: "
17+
f"{OpenSSL.SSL.SSLeay_version(OpenSSL.SSL.SSLEAY_VERSION)!r}\n"
1718
f"cryptography: {cryptography.__version__}"
1819
)
1920

tox.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ commands =
4242
ruff format --check .
4343

4444
[testenv:py311-mypy]
45+
extras =
46+
test
4547
deps =
4648
mypy
47-
skip_install = true
4849
commands =
49-
mypy src
50+
mypy src/ tests/conftest.py
5051

5152
[testenv:check-manifest]
5253
deps =

0 commit comments

Comments
 (0)