]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
Fix format string for Python 2.6
authorSamuel Fekete <samuel.fekete@hogarthww.com>
Wed, 18 Oct 2017 11:44:52 +0000 (12:44 +0100)
committerSamuel Fekete <samuel.fekete@gmail.com>
Fri, 13 Jul 2018 15:40:35 +0000 (16:40 +0100)
tests/integration/test_proxy.py

index ab104b11bcffdfb2c7bdda79ec75aebca2f70db2..d3c8df159616a087e4060a3172c731f88be04001 100644 (file)
@@ -4,7 +4,6 @@
 # External imports
 import multiprocessing
 import pytest
-requests = pytest.importorskip("requests")
 
 from six.moves import socketserver, SimpleHTTPServer
 from six.moves.urllib.request import urlopen
@@ -12,6 +11,9 @@ from six.moves.urllib.request import urlopen
 # Internal imports
 import vcr
 
+# Conditional imports
+requests = pytest.importorskip("requests")
+
 
 class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
     '''
@@ -24,13 +26,13 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
 
 
 @pytest.yield_fixture(scope='session')
-def proxy_server(httpbin):
-    httpd = socketserver.ForkingTCPServer(('', 0), Proxy)
+def proxy_server():
+    httpd = socketserver.ThreadingTCPServer(('', 0), Proxy)
     proxy_process = multiprocessing.Process(
         target=httpd.serve_forever,
     )
     proxy_process.start()
-    yield 'http://{}:{}'.format(*httpd.server_address)
+    yield 'http://{0}:{1}'.format(*httpd.server_address)
     proxy_process.terminate()