Skip to content

Commit c8ea6a8

Browse files
committed
Use 'localhost' instead of '127.0.0.1' to prevent errors when testing with Python 3.4
1 parent d340081 commit c8ea6a8

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

.travis.yml

+22-12
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,40 @@ matrix:
1717
include:
1818
- python: "3.4"
1919
env:
20-
- EVENT_LOOP=asyncio
21-
- TIMEOUT=2.0
20+
- EVENT_LOOP=asyncio
21+
- TIMEOUT=8.0
2222
- python: "3.5"
2323
env:
24-
- EVENT_LOOP=asyncio
25-
- TIMEOUT=2.0
24+
- EVENT_LOOP=asyncio
25+
- TIMEOUT=2.0
2626
- python: "3.5"
2727
env:
28-
- EVENT_LOOP=uvloop
29-
- TIMEOUT=2.0
28+
- EVENT_LOOP=uvloop
29+
- TIMEOUT=2.0
3030
before_script: "pip install .[uvloop]"
3131
- python: "3.6"
3232
env:
33-
- EVENT_LOOP=asyncio
34-
- TIMEOUT=2.0
33+
- EVENT_LOOP=asyncio
34+
- TIMEOUT=2.0
3535
- python: "3.6"
3636
env:
37-
- EVENT_LOOP=uvloop
38-
- TIMEOUT=2.0
37+
- EVENT_LOOP=uvloop
38+
- TIMEOUT=2.0
3939
before_script: "pip install .[uvloop]"
40+
# TODO: Enable once 3.7 support has been added
41+
# - python: "3.7"
42+
# env:
43+
# - EVENT_LOOP=asyncio
44+
# - TIMEOUT=2.0
45+
# - python: "3.7"
46+
# env:
47+
# - EVENT_LOOP=uvloop
48+
# - TIMEOUT=2.0
49+
# before_script: "pip install .[uvloop]"
4050
- python: "pypy3" # 2017-08-05: It's pypy3-5.8.0-beta
4151
env:
42-
- EVENT_LOOP=asyncio
43-
- TIMEOUT=16.0
52+
- EVENT_LOOP=asyncio
53+
- TIMEOUT=16.0
4454
# TODO: Re-enable once pypy3 is able to compile uvloop
4555
# - python: "pypy3" # 2017-08-05: It's pypy3-5.8.0-beta
4656
# env:

tests/conftest.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def pytest_namespace():
6161
'have_uvloop': pytest.mark.skipif(not have_uvloop, reason='requires uvloop'),
6262
'no_uvloop': pytest.mark.skipif(
6363
have_uvloop, reason='requires uvloop to be not installed'),
64-
'ip': '127.0.0.1',
64+
'host': 'localhost',
6565
'port': 8766,
6666
'cli_path': os.path.join(sys.exec_prefix, 'bin', 'saltyrtc-server'),
6767
'key': os.path.normpath(
@@ -103,7 +103,7 @@ def unused_tcp_port():
103103
Find an unused localhost TCP port from 1024-65535 and return it.
104104
"""
105105
with closing(socket.socket()) as sock:
106-
sock.bind((pytest.saltyrtc.ip, 0))
106+
sock.bind((pytest.saltyrtc.host, 0))
107107
return sock.getsockname()[1]
108108

109109

@@ -319,15 +319,15 @@ def _server_factory(permanent_keys=None):
319319
pytest.saltyrtc.cert, keyfile=pytest.saltyrtc.key,
320320
dh_params_file=pytest.saltyrtc.dh_params),
321321
permanent_keys,
322-
host=pytest.saltyrtc.ip,
322+
host=pytest.saltyrtc.host,
323323
port=port,
324324
loop=event_loop,
325325
server_class=TestServer,
326326
)
327327
server_ = event_loop.run_until_complete(coroutine)
328328
# Inject timeout and address (little bit of a hack but meh...)
329329
server_.timeout = _get_timeout(request=request)
330-
server_.address = (pytest.saltyrtc.ip, port)
330+
server_.address = (pytest.saltyrtc.host, port)
331331

332332
_server_instances.append(server_)
333333

0 commit comments

Comments
 (0)