| 1 |
# Copyright (c) The pyOpenSSL developers |
| 2 |
# See LICENSE for details. |
| 3 |
|
| 4 |
import pathlib |
| 5 |
from tempfile import mktemp |
| 6 |
|
| 7 |
import pytest |
| 8 |
|
| 9 |
from OpenSSL.SSL import OPENSSL_VERSION, SSLeay_version |
| 10 |
|
| 11 |
is_awslc = b"AWS-LC" in SSLeay_version(OPENSSL_VERSION) |
| 12 |
|
| 13 |
|
| 14 |
def pytest_report_header(config: pytest.Config) -> str: |
| 15 |
import cryptography |
| 16 |
|
| 17 |
import OpenSSL.SSL |
| 18 |
|
| 19 |
return ( |
| 20 |
f"OpenSSL: " |
| 21 |
f"{OpenSSL.SSL.SSLeay_version(OpenSSL.SSL.SSLEAY_VERSION)!r}\n" |
| 22 |
f"cryptography: {cryptography.__version__}" |
| 23 |
) |
| 24 |
|
| 25 |
|
| 26 |
@pytest.fixture |
| 27 |
def tmpfile(tmp_path: pathlib.Path) -> bytes: |
| 28 |
""" |
| 29 |
Return UTF-8-encoded bytes of a path to a tmp file. |
| 30 |
|
| 31 |
The file will be cleaned up after the test run. |
| 32 |
""" |
| 33 |
return mktemp(dir=tmp_path).encode("utf-8") |