Skip to content

Commit 5933c82

Browse files
authored
Merge pull request #201 from TheJokr/fix-pytest-namespace
Fixed test setup for pytest >= 4.1
2 parents 0fedbba + b09b6a1 commit 5933c82

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def etag(self, env, start_response):
6464
headers = [("Etag", self.etag_string)]
6565
if env.get("HTTP_IF_NONE_MATCH") == self.etag_string:
6666
start_response("304 Not Modified", headers)
67+
return []
6768
else:
6869
start_response("200 OK", headers)
6970
return [pformat(env).encode("utf8")]
@@ -107,7 +108,7 @@ def __call__(self, env, start_response):
107108

108109
@pytest.fixture(scope="session")
109110
def server():
110-
return pytest.server
111+
return cherrypy.server
111112

112113

113114
@pytest.fixture()
@@ -124,7 +125,7 @@ def get_free_port():
124125
return ip, port
125126

126127

127-
def pytest_namespace():
128+
def pytest_configure(config):
128129
cherrypy.tree.graft(SimpleApp(), "/")
129130

130131
ip, port = get_free_port()
@@ -136,7 +137,6 @@ def pytest_namespace():
136137
logger.removeHandler(logger.handlers[0])
137138

138139
cherrypy.server.start()
139-
return {"server": cherrypy.server}
140140

141141

142142
def pytest_unconfigure(config):

0 commit comments

Comments
 (0)