conftest.py 609 B

1234567891011121314151617181920212223242526
  1. # Copyright (c) The pyOpenSSL developers
  2. # See LICENSE for details.
  3. from tempfile import mktemp
  4. import pytest
  5. def pytest_report_header(config):
  6. import OpenSSL.SSL
  7. import cryptography
  8. return "OpenSSL: {openssl}\ncryptography: {cryptography}".format(
  9. openssl=OpenSSL.SSL.SSLeay_version(OpenSSL.SSL.SSLEAY_VERSION),
  10. cryptography=cryptography.__version__,
  11. )
  12. @pytest.fixture
  13. def tmpfile(tmpdir):
  14. """
  15. Return UTF-8-encoded bytes of a path to a tmp file.
  16. The file will be cleaned up after the test run.
  17. """
  18. return mktemp(dir=tmpdir.dirname).encode("utf-8")