1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 09:13:23 +00:00

Fix socketserver for Python 3

This commit is contained in:
Samuel Fekete
2017-07-03 15:29:36 +01:00
committed by Samuel Fekete
parent 365a98bf66
commit bed9e520a3

View File

@@ -3,11 +3,10 @@
# External imports # External imports
import multiprocessing import multiprocessing
import SocketServer
import SimpleHTTPServer
import pytest import pytest
requests = pytest.importorskip("requests") requests = pytest.importorskip("requests")
from six.moves import socketserver, SimpleHTTPServer
from six.moves.urllib.request import urlopen from six.moves.urllib.request import urlopen
# Internal imports # Internal imports
@@ -26,7 +25,7 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
@pytest.yield_fixture(scope='session') @pytest.yield_fixture(scope='session')
def proxy_server(httpbin): def proxy_server(httpbin):
httpd = SocketServer.ForkingTCPServer(('', 0), Proxy) httpd = socketserver.ForkingTCPServer(('', 0), Proxy)
proxy_process = multiprocessing.Process( proxy_process = multiprocessing.Process(
target=httpd.serve_forever, target=httpd.serve_forever,
) )