mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 17:15:35 +00:00
Fix format string for Python 2.6
This commit is contained in:
committed by
Samuel Fekete
parent
eb4774a7d2
commit
06dc2190d6
@@ -4,7 +4,6 @@
|
|||||||
# External imports
|
# External imports
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import pytest
|
import pytest
|
||||||
requests = pytest.importorskip("requests")
|
|
||||||
|
|
||||||
from six.moves import socketserver, SimpleHTTPServer
|
from six.moves import socketserver, SimpleHTTPServer
|
||||||
from six.moves.urllib.request import urlopen
|
from six.moves.urllib.request import urlopen
|
||||||
@@ -12,6 +11,9 @@ from six.moves.urllib.request import urlopen
|
|||||||
# Internal imports
|
# Internal imports
|
||||||
import vcr
|
import vcr
|
||||||
|
|
||||||
|
# Conditional imports
|
||||||
|
requests = pytest.importorskip("requests")
|
||||||
|
|
||||||
|
|
||||||
class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||||
'''
|
'''
|
||||||
@@ -24,13 +26,13 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.yield_fixture(scope='session')
|
@pytest.yield_fixture(scope='session')
|
||||||
def proxy_server(httpbin):
|
def proxy_server():
|
||||||
httpd = socketserver.ForkingTCPServer(('', 0), Proxy)
|
httpd = socketserver.ThreadingTCPServer(('', 0), Proxy)
|
||||||
proxy_process = multiprocessing.Process(
|
proxy_process = multiprocessing.Process(
|
||||||
target=httpd.serve_forever,
|
target=httpd.serve_forever,
|
||||||
)
|
)
|
||||||
proxy_process.start()
|
proxy_process.start()
|
||||||
yield 'http://{}:{}'.format(*httpd.server_address)
|
yield 'http://{0}:{1}'.format(*httpd.server_address)
|
||||||
proxy_process.terminate()
|
proxy_process.terminate()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user