File: conftest.py

package info (click to toggle)
pyopenssl 25.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,252 kB
  • sloc: python: 8,292; makefile: 116
file content (29 lines) | stat: -rw-r--r-- 635 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Copyright (c) The pyOpenSSL developers
# See LICENSE for details.

import pathlib
from tempfile import mktemp

import pytest


def pytest_report_header(config: pytest.Config) -> str:
    import cryptography

    import OpenSSL.SSL

    return (
        f"OpenSSL: "
        f"{OpenSSL.SSL.SSLeay_version(OpenSSL.SSL.SSLEAY_VERSION)!r}\n"
        f"cryptography: {cryptography.__version__}"
    )


@pytest.fixture
def tmpfile(tmp_path: pathlib.Path) -> bytes:
    """
    Return UTF-8-encoded bytes of a path to a tmp file.

    The file will be cleaned up after the test run.
    """
    return mktemp(dir=tmp_path).encode("utf-8")