File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python
2
2
# -*- coding: utf-8 -*-
3
3
4
- __version__ = "0.7.4 "
4
+ __version__ = "0.7.5 "
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ def teardown():
94
94
95
95
96
96
@pytest .fixture (autouse = True )
97
- def _configure_application (request ):
97
+ def _configure_application (request , monkeypatch ):
98
98
"""Use `pytest.mark.app` decorator to pass options to your application
99
99
factory::
100
100
@@ -110,7 +110,7 @@ def test_something(app):
110
110
options = request .keywords .get ('app' , None )
111
111
if options :
112
112
for key , value in options .kwargs .items ():
113
- app .config [ key .upper ()] = value
113
+ monkeypatch . setitem ( app .config , key .upper (), value )
114
114
115
115
116
116
def pytest_configure (config ):
Original file line number Diff line number Diff line change 2
2
# -*- coding: utf-8 -*-
3
3
import pytest
4
4
5
+ from flask import Flask
6
+
7
+
8
+ @pytest .fixture (scope = 'session' )
9
+ def app ():
10
+ app = Flask (__name__ )
11
+ app .config ['SECRET_KEY' ] = '42'
12
+ return app
13
+
5
14
6
15
class TestAppMarker :
7
16
@@ -12,3 +21,6 @@ def test_not_debug_app(self, app):
12
21
@pytest .mark .app (foo = 42 )
13
22
def test_update_application_config (self , config ):
14
23
assert config ['FOO' ] == 42
24
+
25
+ def test_application_config_teardown (self , config ):
26
+ assert 'FOO' not in config
You can’t perform that action at this time.
0 commit comments