Skip to content

Commit b55ee96

Browse files
authored
Error if hostname not defined (man-group#128)
* Error if hostname not defined * Update CHANGES.md
1 parent 3229ca4 commit b55ee96

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGES.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11

22
## Changelog
33

4-
### 1.6.2 (Unreleased)
4+
### 1.7.0
5+
* pytest-server-fixtures: if host not defined, use localhost
6+
7+
### 1.6.2 (2019-02-21)
58
* pytest-server-fixtures: suppress stacktrace if kill() is called
69
* pytest-server-fixtures: fix random port logic in TestServerV2
710

pytest-server-fixtures/pytest_server_fixtures/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ class FixtureConfig(Config):
3535
)
3636

3737
# Default values for system resource locations - patch this to change defaults
38-
DEFAULT_SERVER_FIXTURES_HOSTNAME = socket.gethostbyname(socket.gethostname())
38+
try:
39+
DEFAULT_SERVER_FIXTURES_HOSTNAME = socket.gethostbyname(socket.gethostname())
40+
except socket.gaierror:
41+
DEFAULT_SERVER_FIXTURES_HOSTNAME = '127.0.0.1'
3942
DEFAULT_SERVER_FIXTURES_SESSION_ID = get_random_id(SESSION_ID_LEN)
4043
DEFAULT_SERVER_FIXTURES_DISABLE_HTTP_PROXY = True
4144
DEFAULT_SERVER_FIXTURES_SERVER_CLASS = 'thread'

0 commit comments

Comments
 (0)