Hello community,
here is the log from the commit of package python-pytest-flask for
openSUSE:Factory checked in at 2020-03-19 19:48:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest-flask (Old)
and /work/SRC/openSUSE:Factory/.python-pytest-flask.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-flask"
Thu Mar 19 19:48:19 2020 rev:3 rq:785476 version:1.0.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pytest-flask/python-pytest-flask.changes
2020-02-20 14:58:44.702684185 +0100
+++
/work/SRC/openSUSE:Factory/.python-pytest-flask.new.3160/python-pytest-flask.changes
2020-03-19 19:51:30.884226206 +0100
@@ -1,0 +2,8 @@
+Mon Mar 16 08:31:01 UTC 2020 - Tomáš Chvátal <[email protected]>
+
+- Update to 1.0.0:
+ * live_server is now session-scoped by default.
+ * pytest 5.2 or later is now required.
+ * Python 2.7 and 3.4 are no longer supported.
+
+-------------------------------------------------------------------
Old:
----
pytest-flask-0.15.1.tar.gz
New:
----
pytest-flask-1.0.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pytest-flask.spec ++++++
--- /var/tmp/diff_new_pack.hHuDRb/_old 2020-03-19 19:51:33.336227621 +0100
+++ /var/tmp/diff_new_pack.hHuDRb/_new 2020-03-19 19:51:33.340227624 +0100
@@ -17,8 +17,9 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
+%define skip_python2 1
Name: python-pytest-flask
-Version: 0.15.1
+Version: 1.0.0
Release: 0
Summary: A set of py.test fixtures to test Flask applications
License: MIT
@@ -27,14 +28,14 @@
BuildRequires: %{python_module Flask}
BuildRequires: %{python_module Werkzeug >= 0.7}
BuildRequires: %{python_module devel}
-BuildRequires: %{python_module pytest >= 3.6}
+BuildRequires: %{python_module pytest >= 5.2}
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-Flask
Requires: python-Werkzeug >= 0.7
-Requires: python-pytest >= 3.6
+Requires: python-pytest >= 5.2
BuildArch: noarch
%python_subpackages
++++++ pytest-flask-0.15.1.tar.gz -> pytest-flask-1.0.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/.github/workflows/main.yml
new/pytest-flask-1.0.0/.github/workflows/main.yml
--- old/pytest-flask-0.15.1/.github/workflows/main.yml 2020-02-03
23:10:06.000000000 +0100
+++ new/pytest-flask-1.0.0/.github/workflows/main.yml 2020-03-03
13:23:10.000000000 +0100
@@ -11,17 +11,15 @@
fail-fast: false
matrix:
tox_env: [
- "py27",
"py35",
"py36",
"py37",
"py38",
"pre",
+ "linting",
]
include:
- - tox_env: "py27"
- python: "2.7"
- tox_env: "py35"
python: "3.5"
- tox_env: "py36"
@@ -32,7 +30,9 @@
python: "3.8"
- tox_env: "pre"
python: "3.7"
-
+ - tox_env: "linting"
+ python: "3.7"
+
steps:
- uses: actions/checkout@v1
- name: Set up Python
@@ -46,7 +46,7 @@
- name: Test
run: |
tox -e ${{ matrix.tox_env }}
-
+
deploy:
if: github.event_name == 'push' && startsWith(github.event.ref,
'refs/tags')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/.pre-commit-config.yaml
new/pytest-flask-1.0.0/.pre-commit-config.yaml
--- old/pytest-flask-0.15.1/.pre-commit-config.yaml 1970-01-01
01:00:00.000000000 +0100
+++ new/pytest-flask-1.0.0/.pre-commit-config.yaml 2020-03-03
13:23:10.000000000 +0100
@@ -0,0 +1,22 @@
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v2.2.3
+ hooks:
+ - id: trailing-whitespace
+ - id: end-of-file-fixer
+ - id: fix-encoding-pragma
+ args: [--remove]
+ - id: check-yaml
+- repo: https://github.com/asottile/reorder_python_imports
+ rev: v1.4.0
+ hooks:
+ - id: reorder-python-imports
+ args: ['--application-directories=.:src', --py3-plus]
+- repo: local
+ hooks:
+ - id: rst
+ name: rst
+ entry: rst-lint --encoding utf-8
+ files: ^(HOWTORELEASE.rst|README.rst)$
+ language: python
+ additional_dependencies: [pygments, restructuredtext_lint]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/PKG-INFO
new/pytest-flask-1.0.0/PKG-INFO
--- old/pytest-flask-0.15.1/PKG-INFO 2020-02-03 23:10:12.000000000 +0100
+++ new/pytest-flask-1.0.0/PKG-INFO 2020-03-03 13:23:16.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pytest-flask
-Version: 0.15.1
+Version: 1.0.0
Summary: A set of py.test fixtures to test Flask applications.
Home-page: https://github.com/vitalk/pytest-flask
Author: Vital Kudzelka
@@ -112,22 +112,20 @@
Keywords: pytest flask testing
Platform: any
-Classifier: Development Status :: 4 - Beta
+Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Plugins
Classifier: Environment :: Web Environment
+Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
-Classifier: Topic :: Software Development :: Testing
+Classifier: Programming Language :: Python
Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: Software Development :: Testing
+Requires-Python: >=3.5
Provides-Extra: docs
Provides-Extra: tests
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/docs/changelog.rst
new/pytest-flask-1.0.0/docs/changelog.rst
--- old/pytest-flask-0.15.1/docs/changelog.rst 2020-02-03 23:10:06.000000000
+0100
+++ new/pytest-flask-1.0.0/docs/changelog.rst 2020-03-03 13:23:10.000000000
+0100
@@ -3,6 +3,21 @@
Changelog
=========
+1.0.0 (2020-03-03)
+------------------
+
+**Important**
+
+- ``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.
+
+- pytest 5.2 or later is now required.
+
+- Python 2.7 and 3.4 are no longer supported.
+
+.. _@havok2063: https://github.com/havok2063
+.. _@TWood67: https://github.com/TWood67
+.. _#113: https://github.com/pytest-dev/pytest-flask/pull/113
+
0.15.1 (2020-02-03)
-------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/docs/conf.py
new/pytest-flask-1.0.0/docs/conf.py
--- old/pytest-flask-0.15.1/docs/conf.py 2020-02-03 23:10:06.000000000
+0100
+++ new/pytest-flask-1.0.0/docs/conf.py 2020-03-03 13:23:10.000000000 +0100
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# pytest-flask documentation build configuration file, created by
# sphinx-quickstart on Thu Feb 19 17:57:27 2015.
@@ -11,8 +10,9 @@
#
# All configuration values have a default; values that are commented out
# serve to show the default.
-
-import sys, os, datetime
+import datetime
+import os
+import sys
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/docs/features.rst
new/pytest-flask-1.0.0/docs/features.rst
--- old/pytest-flask-0.15.1/docs/features.rst 2020-02-03 23:10:06.000000000
+0100
+++ new/pytest-flask-1.0.0/docs/features.rst 2020-03-03 13:23:10.000000000
+0100
@@ -186,6 +186,21 @@
``request_ctx`` - request context
+`````````````````````````````````
+
+``live_server_scope`` - set the scope of the live server
+``````````````````````````````````````````````````````````````````
+
+By default, the server will be scoped to ``session`` for performance reasons,
however
+if your server has global state and you want better test isolation, you can
use the
+``live_server_scope`` ini option to change the fixture scope:
+
+.. code-block:: ini
+
+ [pytest]
+ live_server_scope = function
+
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The request context which contains all request relevant information.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/pytest_flask/__init__.py
new/pytest-flask-1.0.0/pytest_flask/__init__.py
--- old/pytest-flask-0.15.1/pytest_flask/__init__.py 2020-02-03
23:10:06.000000000 +0100
+++ new/pytest-flask-1.0.0/pytest_flask/__init__.py 2020-03-03
13:23:10.000000000 +0100
@@ -1,4 +1,2 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
from ._version import version as __version__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/pytest_flask/_version.py
new/pytest-flask-1.0.0/pytest_flask/_version.py
--- old/pytest-flask-0.15.1/pytest_flask/_version.py 2020-02-03
23:10:11.000000000 +0100
+++ new/pytest-flask-1.0.0/pytest_flask/_version.py 2020-03-03
13:23:14.000000000 +0100
@@ -1,4 +1,4 @@
# coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version control
-version = '0.15.1'
+version = '1.0.0'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/pytest_flask/fixtures.py
new/pytest-flask-1.0.0/pytest_flask/fixtures.py
--- old/pytest-flask-0.15.1/pytest_flask/fixtures.py 2020-02-03
23:10:06.000000000 +0100
+++ new/pytest-flask-1.0.0/pytest_flask/fixtures.py 2020-03-03
13:23:10.000000000 +0100
@@ -1,19 +1,14 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-import time
+import logging
import multiprocessing
-import pytest
-import socket
-import signal
import os
-import logging
-
-try:
- from urllib2 import URLError, urlopen
-except ImportError:
- from urllib.error import URLError
- from urllib.request import urlopen
+import signal
+import socket
+import time
+from urllib.error import URLError
+from urllib.request import urlopen
+import pytest
from flask import _request_ctx_stack
@@ -45,7 +40,7 @@
request.cls.client = client
-class LiveServer(object):
+class LiveServer:
"""The helper class uses to manage live server. Handles creation and
stopping application in a separate process.
@@ -121,8 +116,12 @@
return sep.join((server_name, new_port))
[email protected](scope='function')
-def live_server(request, app, monkeypatch, pytestconfig):
+def determine_scope(*, fixture_name, config):
+ return config.getini('live_server_scope')
+
+
[email protected](scope=determine_scope)
+def live_server(request, app, pytestconfig):
"""Run application in a separate process.
When the ``live_server`` fixture is applied, the ``url_for`` function
@@ -136,7 +135,10 @@
assert res.code == 200
"""
- port = pytestconfig.getvalue('live_server_port')
+ # Set or get a port
+ port = app.config.get('LIVESERVER_PORT', None)
+ if not port:
+ port = pytestconfig.getvalue('live_server_port')
if port == 0:
# Bind to an open port
@@ -148,10 +150,9 @@
host = pytestconfig.getvalue('live_server_host')
# Explicitly set application ``SERVER_NAME`` for test suite
- # and restore original value on test teardown.
- server_name = app.config['SERVER_NAME'] or 'localhost'
- monkeypatch.setitem(app.config, 'SERVER_NAME',
- _rewrite_server_name(server_name, str(port)))
+ original_server_name = app.config['SERVER_NAME'] or 'localhost'
+ final_server_name = _rewrite_server_name(original_server_name, str(port))
+ app.config['SERVER_NAME'] = final_server_name
clean_stop = request.config.getvalue('live_server_clean_stop')
server = LiveServer(app, host, port, clean_stop)
@@ -159,7 +160,10 @@
server.start()
request.addfinalizer(server.stop)
- return server
+ yield server
+
+ if original_server_name is not None:
+ app.config['SERVER_NAME'] = original_server_name
@pytest.fixture
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/pytest_flask/plugin.py
new/pytest-flask-1.0.0/pytest_flask/plugin.py
--- old/pytest-flask-0.15.1/pytest_flask/plugin.py 2020-02-03
23:10:06.000000000 +0100
+++ new/pytest-flask-1.0.0/pytest_flask/plugin.py 2020-03-03
13:23:10.000000000 +0100
@@ -1,5 +1,4 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
"""
A py.test plugin which helps testing Flask applications.
@@ -9,18 +8,22 @@
import sys
import pytest
-
from flask import json
from werkzeug.utils import cached_property
-from .fixtures import (
- client, config, accept_json, accept_jsonp, accept_any, accept_mimetype,
- client_class, live_server, request_ctx
-)
+from .fixtures import accept_any
+from .fixtures import accept_json
+from .fixtures import accept_jsonp
+from .fixtures import accept_mimetype
+from .fixtures import client
+from .fixtures import client_class
+from .fixtures import config
+from .fixtures import live_server
+from .fixtures import request_ctx
from .pytest_compat import getfixturevalue
-class JSONResponse(object):
+class JSONResponse:
"""Mixin with testing helper methods for JSON responses."""
@cached_property
@@ -38,13 +41,13 @@
# separate so we can simplify the code once Python 2 support is dropped
if sys.version_info[0] == 2:
try:
- super_eq = super(JSONResponse, self).__eq__
+ super_eq = super().__eq__
except AttributeError:
return NotImplemented
else:
return super_eq(other)
else:
- return super(JSONResponse, self).__eq__(other)
+ return super().__eq__(other)
def __ne__(self, other):
return not self == other
@@ -165,6 +168,8 @@
help='use a host where to listen (default localhost).')
group.addoption('--live-server-port', action='store', default=0, type=int,
help='use a fixed port for the live_server fixture.')
+ parser.addini('live_server_scope', 'modify the scope of the live_server
fixture.',
+ default='session')
def pytest_configure(config):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/pytest_flask.egg-info/PKG-INFO
new/pytest-flask-1.0.0/pytest_flask.egg-info/PKG-INFO
--- old/pytest-flask-0.15.1/pytest_flask.egg-info/PKG-INFO 2020-02-03
23:10:11.000000000 +0100
+++ new/pytest-flask-1.0.0/pytest_flask.egg-info/PKG-INFO 2020-03-03
13:23:14.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pytest-flask
-Version: 0.15.1
+Version: 1.0.0
Summary: A set of py.test fixtures to test Flask applications.
Home-page: https://github.com/vitalk/pytest-flask
Author: Vital Kudzelka
@@ -112,22 +112,20 @@
Keywords: pytest flask testing
Platform: any
-Classifier: Development Status :: 4 - Beta
+Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Plugins
Classifier: Environment :: Web Environment
+Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
-Classifier: Topic :: Software Development :: Testing
+Classifier: Programming Language :: Python
Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: Software Development :: Testing
+Requires-Python: >=3.5
Provides-Extra: docs
Provides-Extra: tests
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-flask-0.15.1/pytest_flask.egg-info/SOURCES.txt
new/pytest-flask-1.0.0/pytest_flask.egg-info/SOURCES.txt
--- old/pytest-flask-0.15.1/pytest_flask.egg-info/SOURCES.txt 2020-02-03
23:10:12.000000000 +0100
+++ new/pytest-flask-1.0.0/pytest_flask.egg-info/SOURCES.txt 2020-03-03
13:23:16.000000000 +0100
@@ -1,8 +1,8 @@
.gitignore
+.pre-commit-config.yaml
HOWTORELEASE.rst
LICENSE
README.rst
-setup.cfg
setup.py
tox.ini
.github/workflows/main.yml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-flask-0.15.1/pytest_flask.egg-info/requires.txt
new/pytest-flask-1.0.0/pytest_flask.egg-info/requires.txt
--- old/pytest-flask-0.15.1/pytest_flask.egg-info/requires.txt 2020-02-03
23:10:11.000000000 +0100
+++ new/pytest-flask-1.0.0/pytest_flask.egg-info/requires.txt 2020-03-03
13:23:14.000000000 +0100
@@ -1,7 +1,6 @@
-pytest>=3.6
+pytest>=5.2
Flask
Werkzeug>=0.7
-pytest
[docs]
Sphinx
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/requirements/main.txt
new/pytest-flask-1.0.0/requirements/main.txt
--- old/pytest-flask-0.15.1/requirements/main.txt 2020-02-03
23:10:06.000000000 +0100
+++ new/pytest-flask-1.0.0/requirements/main.txt 2020-03-03
13:23:10.000000000 +0100
@@ -1,3 +1,3 @@
-pytest>=3.6
+pytest>=5.2
Flask
Werkzeug>=0.7
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/setup.cfg
new/pytest-flask-1.0.0/setup.cfg
--- old/pytest-flask-0.15.1/setup.cfg 2020-02-03 23:10:12.000000000 +0100
+++ new/pytest-flask-1.0.0/setup.cfg 2020-03-03 13:23:16.000000000 +0100
@@ -1,6 +1,3 @@
-[wheel]
-universal = 1
-
[egg_info]
tag_build =
tag_date = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/setup.py
new/pytest-flask-1.0.0/setup.py
--- old/pytest-flask-0.15.1/setup.py 2020-02-03 23:10:06.000000000 +0100
+++ new/pytest-flask-1.0.0/setup.py 2020-03-03 13:23:10.000000000 +0100
@@ -1,5 +1,4 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
"""
pytest-flask
============
@@ -102,22 +101,21 @@
**suggestion**.
"""
-import io
import os
-import re
-from setuptools import setup
+
from setuptools import find_packages
+from setuptools import setup
def read(*parts):
"""Reads the content of the file located at path created from *parts*."""
try:
- return io.open(os.path.join(*parts), 'r', encoding='utf-8').read()
- except IOError:
+ return open(os.path.join(*parts), 'r', encoding='utf-8').read()
+ except OSError:
return ''
-requirements = read('requirements', 'main.txt').splitlines() + ['pytest']
+requirements = read('requirements', 'main.txt').splitlines()
tests_require = []
extras_require = {
@@ -156,26 +154,24 @@
keywords='pytest flask testing',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
- 'Development Status :: 4 - Beta',
+ 'Development Status :: 5 - Production/Stable',
'Environment :: Plugins',
'Environment :: Web Environment',
+ 'Framework :: Pytest',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
- 'Programming Language :: Python',
- 'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 2.7',
- 'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
- 'Topic :: Software Development :: Testing',
+ 'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
+ 'Topic :: Software Development :: Testing',
],
+ python_requires=">=3.5",
- # The following makes a plugin available to pytest
+ # The following makes the plugin available to pytest
entry_points={
'pytest11': [
'flask = pytest_flask.plugin',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/tests/conftest.py
new/pytest-flask-1.0.0/tests/conftest.py
--- old/pytest-flask-0.15.1/tests/conftest.py 2020-02-03 23:10:06.000000000
+0100
+++ new/pytest-flask-1.0.0/tests/conftest.py 2020-03-03 13:23:10.000000000
+0100
@@ -1,15 +1,15 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-import pytest
-
from textwrap import dedent
-from flask import Flask, jsonify
+
+import pytest
+from flask import Flask
+from flask import jsonify
pytest_plugins = 'pytester'
[email protected]
[email protected](scope='session')
def app():
app = Flask(__name__)
app.config['SECRET_KEY'] = '42'
@@ -42,7 +42,7 @@
from flask import Flask
- @pytest.fixture
+ @pytest.fixture(scope='session')
def app():
app = Flask(__name__)
return app
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/tests/test_fixtures.py
new/pytest-flask-1.0.0/tests/test_fixtures.py
--- old/pytest-flask-0.15.1/tests/test_fixtures.py 2020-02-03
23:10:06.000000000 +0100
+++ new/pytest-flask-1.0.0/tests/test_fixtures.py 2020-03-03
13:23:10.000000000 +0100
@@ -1,8 +1,7 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
import pytest
-
-from flask import request, url_for
+from flask import request
+from flask import url_for
class TestFixtures:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/tests/test_live_server.py
new/pytest-flask-1.0.0/tests/test_live_server.py
--- old/pytest-flask-0.15.1/tests/test_live_server.py 2020-02-03
23:10:06.000000000 +0100
+++ new/pytest-flask-1.0.0/tests/test_live_server.py 2020-03-03
13:23:10.000000000 +0100
@@ -1,13 +1,8 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
import os
+from urllib.request import urlopen
import pytest
-try:
- from urllib2 import urlopen
-except ImportError:
- from urllib.request import urlopen
-
from flask import url_for
@@ -38,10 +33,18 @@
assert live_server.app.config['SERVER_NAME'] == \
'localhost:%d' % live_server.port
- @pytest.mark.options(server_name='example.com:5000')
- def test_rewrite_application_server_name(self, live_server):
- assert live_server.app.config['SERVER_NAME'] == \
- 'example.com:%d' % live_server.port
+ def test_rewrite_application_server_name(self, appdir):
+ appdir.create_test_module('''
+ import pytest
+ @pytest.mark.options(server_name='example.com:5000')
+ def test_a(live_server):
+ assert live_server.app.config['SERVER_NAME'] == \\
+ 'example.com:%d' % live_server.port
+ ''')
+
+ result = appdir.runpytest('-v', '-o', 'live_server_scope=function')
+ result.stdout.fnmatch_lines(['*PASSED*'])
+ assert result.ret == 0
def test_prevent_starting_live_server(self, appdir):
appdir.create_test_module('''
@@ -52,7 +55,7 @@
''')
result = appdir.runpytest('-v', '--no-start-live-server')
- result.stdout.fnmatch_lines(['*PASSED*'])
+ result.stdout.fnmatch_lines(['*passed*'])
assert result.ret == 0
def test_start_live_server(self, appdir):
@@ -64,7 +67,7 @@
assert live_server._process.is_alive()
''')
result = appdir.runpytest('-v', '--start-live-server')
- result.stdout.fnmatch_lines(['*PASSED*'])
+ result.stdout.fnmatch_lines(['*passed*'])
assert result.ret == 0
@pytest.mark.parametrize('clean_stop', [True, False])
@@ -89,10 +92,7 @@
appdir.create_test_module('''
import pytest
- try:
- from urllib2 import urlopen
- except ImportError:
- from urllib.request import urlopen
+ from urllib.request import urlopen
from flask import url_for
@@ -119,10 +119,7 @@
def test_add_endpoint_to_live_server(self, appdir):
appdir.create_test_module('''
import pytest
- try:
- from urllib2 import urlopen
- except ImportError:
- from urllib.request import urlopen
+ from urllib.request import urlopen
from flask import url_for
@@ -138,16 +135,14 @@
assert b'got it' in res.read()
''')
result = appdir.runpytest('-v', '--no-start-live-server')
- result.stdout.fnmatch_lines(['*PASSED*'])
+ result.stdout.fnmatch_lines(['*passed*'])
assert result.ret == 0
+ @pytest.mark.skip('this test hangs in the original code')
def test_concurrent_requests_to_live_server(self, appdir):
appdir.create_test_module('''
import pytest
- try:
- from urllib2 import urlopen
- except ImportError:
- from urllib.request import urlopen
+ from urllib.request import urlopen
from flask import url_for
@@ -168,7 +163,7 @@
assert b'42' in res.read()
''')
result = appdir.runpytest('-v', '--no-start-live-server')
- result.stdout.fnmatch_lines(['*PASSED*'])
+ result.stdout.fnmatch_lines(['*passed*'])
assert result.ret == 0
@pytest.mark.parametrize('port', [5000, 5001])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/tests/test_markers.py
new/pytest-flask-1.0.0/tests/test_markers.py
--- old/pytest-flask-0.15.1/tests/test_markers.py 2020-02-03
23:10:06.000000000 +0100
+++ new/pytest-flask-1.0.0/tests/test_markers.py 2020-03-03
13:23:10.000000000 +0100
@@ -1,7 +1,5 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
import pytest
-
from flask import Flask
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-flask-0.15.1/tox.ini
new/pytest-flask-1.0.0/tox.ini
--- old/pytest-flask-0.15.1/tox.ini 2020-02-03 23:10:06.000000000 +0100
+++ new/pytest-flask-1.0.0/tox.ini 2020-03-03 13:23:10.000000000 +0100
@@ -1,6 +1,6 @@
[tox]
envlist =
- py{27,34,35,36,37}
+ py{35,36,37,38,linting}
[pytest]
@@ -15,7 +15,7 @@
usedevelop = True
deps =
-rrequirements/main.txt
- -rrequirements/test.txt
+ -rrequirements/test.txt
passenv = HOME LANG LC_ALL
@@ -35,6 +35,12 @@
deps = {[testenv]deps}
commands = {[testenv]commands}
+[testenv:linting]
+skip_install = True
+basepython = python3
+deps = pre-commit>=1.11.0
+commands = pre-commit run --all-files --show-diff-on-failure {posargs:}
+
[testenv:docs]
changedir = docs
skipsdist = True