Skip to content

Commit d701554

Browse files
authored
Merge pull request #116 from nicoddemus/release-1.0.0
Release 1.0.0
2 parents 5941e8e + 1dc077a commit d701554

File tree

7 files changed

+32
-22
lines changed

7 files changed

+32
-22
lines changed

docs/changelog.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,20 @@
33
Changelog
44
=========
55

6-
1.0.0 (UNRELEASED)
6+
1.0.0 (2020-03-03)
77
------------------
88

9-
- Python 2.7 is no longer supported.
9+
**Important**
10+
11+
- ``live_server`` is now ``session``-scoped by default. This can be changed by using the ``live-server_scope`` option in your ``pytest.ini`` (`#113`_). Thanks `@havok2063`_ for the initial patch and `@TWood67`_ for finishing it up.
12+
13+
- pytest 5.2 or later is now required.
14+
15+
- Python 2.7 and 3.4 are no longer supported.
16+
17+
.. _@havok2063: https://github.com/havok2063
18+
.. _@TWood67: https://github.com/TWood67
19+
.. _#113: https://github.com/pytest-dev/pytest-flask/pull/113
1020

1121
0.15.1 (2020-02-03)
1222
-------------------

docs/features.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,17 @@ in your project's ``pytest.ini`` file)::
188188
``request_ctx`` - request context
189189
`````````````````````````````````
190190

191-
``--live-server-scope`` - set the scope of the live server
191+
``live_server_scope`` - set the scope of the live server
192192
``````````````````````````````````````````````````````````````````
193193

194-
By default, the server will be scoped to `session`. In some cases, you may want
195-
it to be fixed to a different scope. You can use ``--live-server-scope`` (for example,
196-
in your project's ``pytest.ini`` file)::
194+
By default, the server will be scoped to ``session`` for performance reasons, however
195+
if your server has global state and you want better test isolation, you can use the
196+
``live_server_scope`` ini option to change the fixture scope:
197+
198+
.. code-block:: ini
197199
198200
[pytest]
199-
addopts = --live-server-scope=function
201+
live_server_scope = function
200202
201203
202204
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

pytest_flask/fixtures.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ def _rewrite_server_name(server_name, new_port):
116116
return sep.join((server_name, new_port))
117117

118118

119-
def determine_scope(fixture_name, config):
120-
return config.getoption('--live-server-scope', 'session')
119+
def determine_scope(*, fixture_name, config):
120+
return config.getini('live_server_scope')
121121

122122

123123
@pytest.fixture(scope=determine_scope)

pytest_flask/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ def pytest_addoption(parser):
168168
help='use a host where to listen (default localhost).')
169169
group.addoption('--live-server-port', action='store', default=0, type=int,
170170
help='use a fixed port for the live_server fixture.')
171-
group.addoption('--live-server-scope', action='store', default='session', type=str,
172-
help='modify the scope of the live_server fixture.')
171+
parser.addini('live_server_scope', 'modify the scope of the live_server fixture.',
172+
default='session')
173173

174174

175175
def pytest_configure(config):

requirements/main.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
pytest>=3.6
1+
pytest>=5.2
22
Flask
33
Werkzeug>=0.7

setup.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def read(*parts):
115115
return ''
116116

117117

118-
requirements = read('requirements', 'main.txt').splitlines() + ['pytest']
118+
requirements = read('requirements', 'main.txt').splitlines()
119119
tests_require = []
120120

121121
extras_require = {
@@ -154,26 +154,24 @@ def read(*parts):
154154
keywords='pytest flask testing',
155155
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
156156
classifiers=[
157-
'Development Status :: 4 - Beta',
157+
'Development Status :: 5 - Production/Stable',
158158
'Environment :: Plugins',
159159
'Environment :: Web Environment',
160+
'Framework :: Pytest',
160161
'Intended Audience :: Developers',
161162
'License :: OSI Approved :: MIT License',
162163
'Operating System :: OS Independent',
163-
'Programming Language :: Python',
164-
'Programming Language :: Python :: 2',
165-
'Programming Language :: Python :: 2.7',
166-
'Programming Language :: Python :: 3',
167-
'Programming Language :: Python :: 3.4',
168164
'Programming Language :: Python :: 3.5',
169165
'Programming Language :: Python :: 3.6',
170166
'Programming Language :: Python :: 3.7',
171167
'Programming Language :: Python :: 3.8',
172-
'Topic :: Software Development :: Testing',
168+
'Programming Language :: Python',
173169
'Topic :: Software Development :: Libraries :: Python Modules',
170+
'Topic :: Software Development :: Testing',
174171
],
172+
python_requires=">=3.5",
175173

176-
# The following makes a plugin available to pytest
174+
# The following makes the plugin available to pytest
177175
entry_points={
178176
'pytest11': [
179177
'flask = pytest_flask.plugin',

tests/test_live_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def test_a(live_server):
4242
'example.com:%d' % live_server.port
4343
''')
4444

45-
result = appdir.runpytest('-v', '--live-server-scope=function')
45+
result = appdir.runpytest('-v', '-o', 'live_server_scope=function')
4646
result.stdout.fnmatch_lines(['*PASSED*'])
4747
assert result.ret == 0
4848

0 commit comments

Comments
 (0)