Skip to content

Commit 21caefa

Browse files
committed
Merge pull request #35 from vitalk/rename-marker-used-to-pass-options-to-app
Rename marker used to pass options to app.
2 parents 98ab0bf + 7cec76d commit 21caefa

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

docs/features.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,10 @@ Markers
210210
on `what markers are`_ and for notes on `using them`_.
211211

212212

213-
``pytest.mark.app`` - pass options to your application config
213+
``pytest.mark.options`` - pass options to your application config
214214
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
215215

216-
.. py:function:: pytest.mark.app(**kwargs)
216+
.. py:function:: pytest.mark.options(**kwargs)
217217
218218
The mark uses to pass options to your application config.
219219

@@ -225,7 +225,7 @@ on `what markers are`_ and for notes on `using them`_.
225225

226226
.. code:: python
227227
228-
@pytest.mark.app(debug=False)
228+
@pytest.mark.options(debug=False)
229229
def test_app(app):
230230
assert not app.debug, 'Ensure the app not in debug mode'
231231

pytest_flask/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
__version__ = "0.8.1"
4+
__version__ = "0.9.0"

pytest_flask/plugin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ def teardown():
9595

9696
@pytest.fixture(autouse=True)
9797
def _configure_application(request, monkeypatch):
98-
"""Use `pytest.mark.app` decorator to pass options to your application
98+
"""Use `pytest.mark.options` decorator to pass options to your application
9999
factory::
100100
101-
@pytest.mark.app(debug=False)
101+
@pytest.mark.options(debug=False)
102102
def test_something(app):
103103
assert not app.debug, 'the application works not in debug mode!'
104104
@@ -107,8 +107,8 @@ def test_something(app):
107107
return
108108

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

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
- ``accept_json``, ``accept_jsonp``, ``accept_any`` - accept headers
2222
suitable to use as parameters in ``client``.
2323
24-
To pass options to your application use the ``pytest.mark.app`` marker:
24+
To pass options to your application use the ``pytest.mark.options`` marker:
2525
2626
.. code:: python
2727
28-
@pytest.mark.app(debug=False)
28+
@pytest.mark.options(debug=False)
2929
def test_app(app):
3030
assert not app.debug, 'Ensure the app not in debug mode'
3131

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)