Skip to content

Commit fe841a9

Browse files
committed
Rename marker uses to pass options to application factory
- While searching marker definition pytest recursively traverses marker discovery to parent nodes if marker not found. - The `app` marker has the name collision with top parent node, e.g. `app` fixture. - Rename it to ensure the collision doesn't occurs. Closes #34.
1 parent 98ab0bf commit fe841a9

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

pytest_flask/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def test_something(app):
107107
return
108108

109109
app = request.getfuncargvalue('app')
110-
options = request.keywords.get('app', None)
110+
options = request.keywords.get('options')
111111
if options:
112112
for key, value in options.kwargs.items():
113113
monkeypatch.setitem(app.config, key.upper(), value)

tests/test_live_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ def test_url_for(self, live_server):
3030
def test_set_application_server_name(self, live_server):
3131
assert live_server.app.config['SERVER_NAME'] == 'localhost:%d' % live_server.port
3232

33-
@pytest.mark.app(server_name='example.com:5000')
33+
@pytest.mark.options(server_name='example.com:5000')
3434
def test_rewrite_application_server_name(self, live_server):
3535
assert live_server.app.config['SERVER_NAME'] == 'example.com:%d' % live_server.port

tests/test_markers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ def app():
1212
return app
1313

1414

15-
class TestAppMarker:
15+
class TestOptionMarker:
1616

17-
@pytest.mark.app(debug=False)
17+
@pytest.mark.options(debug=False)
1818
def test_not_debug_app(self, app):
1919
assert not app.debug, 'Ensure the app not in debug mode'
2020

21-
@pytest.mark.app(foo=42)
22-
def test_update_application_config(self, config):
21+
@pytest.mark.options(foo=42)
22+
def test_update_application_config(self, request, app, config):
2323
assert config['FOO'] == 42
2424

2525
def test_application_config_teardown(self, config):

0 commit comments

Comments
 (0)