Use pytest tmpdir support
MODIFY
dev-requirements.txt
dev-requirements.txt
@@ -7,7 +7,6 @@ win-inet-pton==1.1.0
pytest==4.6.6
pytest-timeout==1.3.3
flaky==3.6.1
-backports.tempfile==1.0
# https://github.com/GoogleCloudPlatform/python-repo-tools/issues/23
pylint<2.0;python_version<="2.7"

MODIFY
test/with_dummyserver/test_https.py
test/with_dummyserver/test_https.py
@@ -9,7 +9,6 @@ import warnings
import mock
import pytest
-from backports import tempfile
from dummyserver.testcase import HTTPSDummyServerTestCase, IPV6HTTPSDummyServerTestCase
from dummyserver.server import (
@@ -279,15 +278,14 @@ class TestHTTPS(HTTPSDummyServerTestCase):
@onlyPy279OrNewer
@notSecureTransport # SecureTransport does not support cert directories
@notOpenSSL098 # OpenSSL 0.9.8 does not support cert directories
- def test_ca_dir_verified(self):
- with tempfile.TemporaryDirectory() as temp_dir:
+ def test_ca_dir_verified(self, tmpdir):
# OpenSSL looks up certificates by the hash for their name, see c_rehash
# TODO infer the bytes using `cryptography.x509.Name.public_bytes`.
# https://github.com/pyca/cryptography/pull/3236
- shutil.copyfile(DEFAULT_CA, os.path.join(temp_dir, "b6b9ccf9.0"))
+ shutil.copyfile(DEFAULT_CA, os.path.join(tmpdir, "b6b9ccf9.0"))
with HTTPSConnectionPool(
- self.host, self.port, cert_reqs="CERT_REQUIRED", ca_cert_dir=temp_dir
+ self.host, self.port, cert_reqs="CERT_REQUIRED", ca_cert_dir=tmpdir
) as https_pool:
conn = https_pool._new_conn()
assert conn.__class__ == VerifiedHTTPSConnection

Use pytest tmpdir support