Hynek Schlawack | f9182e2 | 2016-03-14 13:51:16 +0100 | [diff] [blame] | 1 | # Copyright (c) The pyOpenSSL developers |
| 2 | # See LICENSE for details. |
| 3 | |
Alex Chan | 6b69c55 | 2016-10-24 16:34:41 +0100 | [diff] [blame] | 4 | from tempfile import mktemp |
| 5 | |
| 6 | import pytest |
| 7 | |
Hynek Schlawack | f9182e2 | 2016-03-14 13:51:16 +0100 | [diff] [blame] | 8 | |
| 9 | def pytest_report_header(config): |
| 10 | import OpenSSL.SSL |
| 11 | import cryptography |
| 12 | |
| 13 | return "OpenSSL: {openssl}\ncryptography: {cryptography}".format( |
| 14 | openssl=OpenSSL.SSL.SSLeay_version(OpenSSL.SSL.SSLEAY_VERSION), |
| 15 | cryptography=cryptography.__version__ |
| 16 | ) |
Alex Chan | 6b69c55 | 2016-10-24 16:34:41 +0100 | [diff] [blame] | 17 | |
| 18 | |
| 19 | @pytest.fixture |
| 20 | def tmpfile(tmpdir): |
| 21 | """ |
| 22 | Return UTF-8-encoded bytes of a path to a tmp file. |
| 23 | |
| 24 | The file will be cleaned up after the test run. |
| 25 | """ |
| 26 | return mktemp(dir=tmpdir.dirname).encode("utf-8") |