Hello community,
here is the log from the commit of package python-pytest-django for
openSUSE:Leap:15.2 checked in at 2020-04-14 14:21:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/python-pytest-django (Old)
and /work/SRC/openSUSE:Leap:15.2/.python-pytest-django.new.3248 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-django"
Tue Apr 14 14:21:23 2020 rev:15 rq:793539 version:3.9.0
Changes:
--------
---
/work/SRC/openSUSE:Leap:15.2/python-pytest-django/python-pytest-django.changes
2020-03-29 14:55:37.579154792 +0200
+++
/work/SRC/openSUSE:Leap:15.2/.python-pytest-django.new.3248/python-pytest-django.changes
2020-04-14 14:21:38.097303769 +0200
@@ -1,0 +2,10 @@
+Fri Apr 3 10:20:28 UTC 2020 - Tomáš Chvátal <[email protected]>
+
+- Update to 3.9.0:
+ * Improve test ordering with Django test classes (#830)
+ * Remove import of pkg_resources for parsing pytest version (performance)
(#826)
+ * Work around unittest issue with pytest 5.4.{0,1} (#825)
+ * Don't break --failed-first when re-ordering tests (#819, #820)
+ * pytest_addoption: use group.addoption (#833)
+
+-------------------------------------------------------------------
Old:
----
pytest-django-3.8.0.tar.gz
New:
----
pytest-django-3.9.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pytest-django.spec ++++++
--- /var/tmp/diff_new_pack.kT6eOV/_old 2020-04-14 14:21:38.477304053 +0200
+++ /var/tmp/diff_new_pack.kT6eOV/_new 2020-04-14 14:21:38.477304053 +0200
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%bcond_without python2
Name: python-pytest-django
-Version: 3.8.0
+Version: 3.9.0
Release: 0
Summary: A Django plugin for py.test
License: BSD-3-Clause
@@ -32,13 +32,13 @@
BuildRequires: %{python_module six}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
-%if %{with python2}
-BuildRequires: python2-pathlib2
-%endif
BuildRequires: sqlite3
Requires: python-Django
Requires: python-pytest
BuildArch: noarch
+%if %{with python2}
+BuildRequires: python2-pathlib2
+%endif
%ifpython2
Requires: python-pathlib2
%endif
++++++ pytest-django-3.8.0.tar.gz -> pytest-django-3.9.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.8.0/.travis.yml
new/pytest-django-3.9.0/.travis.yml
--- old/pytest-django-3.8.0/.travis.yml 2020-01-14 06:19:05.000000000 +0100
+++ new/pytest-django-3.9.0/.travis.yml 2020-03-31 11:52:21.000000000 +0200
@@ -1,5 +1,6 @@
language: python
dist: xenial
+cache: false
jobs:
fast_finish: true
@@ -36,8 +37,9 @@
- python: 3.6
env: TOXENV=py36-djmaster-sqlite-coverage
+ # Explicitly test (older) pytest 5.3.
- python: 3.5
- env: TOXENV=py35-dj110-postgres-coverage
+ env: TOXENV=py35-dj110-postgres-pytest53-coverage
services:
- postgresql
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.8.0/PKG-INFO
new/pytest-django-3.9.0/PKG-INFO
--- old/pytest-django-3.8.0/PKG-INFO 2020-01-14 06:19:20.000000000 +0100
+++ new/pytest-django-3.9.0/PKG-INFO 2020-03-31 11:52:37.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pytest-django
-Version: 3.8.0
+Version: 3.9.0
Summary: A Django plugin for pytest.
Home-page: https://pytest-django.readthedocs.io/
Author: Andreas Pelme
@@ -9,6 +9,7 @@
Maintainer-email: [email protected]
License: BSD-3-Clause
Project-URL: Source, https://github.com/pytest-dev/pytest-django
+Project-URL: Changelog,
https://pytest-django.readthedocs.io/en/latest/changelog.html
Description: .. image::
https://img.shields.io/pypi/v/pytest-django.svg?style=flat
:alt: PyPI Version
:target: https://pypi.python.org/pypi/pytest-django
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.8.0/docs/changelog.rst
new/pytest-django-3.9.0/docs/changelog.rst
--- old/pytest-django-3.8.0/docs/changelog.rst 2020-01-14 06:19:05.000000000
+0100
+++ new/pytest-django-3.9.0/docs/changelog.rst 2020-03-31 11:52:21.000000000
+0200
@@ -1,8 +1,39 @@
Changelog
=========
-3.8.0 (2020-01-14)
-------------------
+v3.9.0 (2020-03-31)
+-------------------
+
+Improvements
+^^^^^^^^^^^^
+
+* Improve test ordering with Django test classes (#830)
+
+* Remove import of pkg_resources for parsing pytest version (performance)
(#826)
+
+Bugfixes
+^^^^^^^^
+
+* Work around unittest issue with pytest 5.4.{0,1} (#825)
+
+* Don't break --failed-first when re-ordering tests (#819, #820)
+
+* pytest_addoption: use `group.addoption` (#833)
+
+Misc
+^^^^
+
+* Remove Django version from --nomigrations heading (#822)
+
+* docs: changelog: prefix headers with v for permalink anchors
+
+* changelog: add custom/fixed anchor for last version
+
+* setup.py: add Changelog to project_urls
+
+
+v3.8.0 (2020-01-14)
+--------------------
Improvements
^^^^^^^^^^^^
@@ -12,8 +43,8 @@
* Report django-configurations setting (#791)
-3.7.0 (2019-11-09)
-------------------
+v3.7.0 (2019-11-09)
+-------------------
Bugfixes
^^^^^^^^
@@ -26,8 +57,8 @@
DB access (#781). pytest-django uses a ``RuntimeError`` now instead.
-3.6.0 (2019-10-17)
-------------------
+v3.6.0 (2019-10-17)
+-------------------
Features
^^^^^^^^
@@ -45,16 +76,16 @@
* Improve/harden internal tests / infrastructure.
-3.5.1 (2019-06-29)
-------------------
+v3.5.1 (2019-06-29)
+-------------------
Bugfixes
^^^^^^^^
* Fix compatibility with pytest 5.x (#751)
-3.5.0 (2019-06-03)
-------------------
+v3.5.0 (2019-06-03)
+-------------------
Features
^^^^^^^^
@@ -79,24 +110,24 @@
* Slightly revisit unittest handling (#740)
-3.4.8 (2019-02-26)
-------------------
+v3.4.8 (2019-02-26)
+-------------------
Bugfixes
^^^^^^^^
* Fix DB renaming fixture for Multi-DB environment with SQLite (#679)
-3.4.7 (2019-02-03)
-------------------
+v3.4.7 (2019-02-03)
+-------------------
Bugfixes
^^^^^^^^
* Fix disabling/handling of unittest methods with pytest 4.2+ (#700)
-3.4.6 (2019-02-01)
-------------------
+v3.4.6 (2019-02-01)
+-------------------
Bugfixes
^^^^^^^^
@@ -109,8 +140,8 @@
* Enable tests for Django 2.2 and add classifier (#693)
* Disallow pytest 4.2.0 in ``install_requires`` (#697)
-3.4.5 (2019-01-07)
-------------------
+v3.4.5 (2019-01-07)
+-------------------
Bugfixes
^^^^^^^^
@@ -124,8 +155,8 @@
* Minor doc fixes (#674)
* tests: fix for pytest 4 (#675)
-3.4.4 (2018-11-13)
-------------------
+v3.4.4 (2018-11-13)
+-------------------
Bugfixes
^^^^^^^^
@@ -153,16 +184,16 @@
* Run black on source.
-3.4.3 (2018-09-16)
-------------------
+v3.4.3 (2018-09-16)
+-------------------
Bugfixes
^^^^^^^^
* Fix OSError with arguments containing ``::`` on Windows (#641).
-3.4.2 (2018-08-20)
-------------------
+v3.4.2 (2018-08-20)
+-------------------
Bugfixes
^^^^^^^^
@@ -171,8 +202,8 @@
* Fixed code for inserting the project to sys.path with pathlib to use an
absolute path, regression in 3.4.0 (#637, #638).
-3.4.0 (2018-08-16)
-------------------
+v3.4.0 (2018-08-16)
+-------------------
Features
^^^^^^^^
@@ -193,8 +224,8 @@
* Removed py dependency, use pathlib instead (#631).
-3.3.3 (2018-07-26)
-------------------
+v3.3.3 (2018-07-26)
+-------------------
Bug fixes
^^^^^^^^^
@@ -209,8 +240,8 @@
* Use sphinx_rtf_theme (#621).
* Minor fixes.
-3.3.2 (2018-06-21)
-------------------
+v3.3.2 (2018-06-21)
+-------------------
Bug fixes
^^^^^^^^^
@@ -223,8 +254,8 @@
* Support Django 2.1 (no changes necessary) (#614).
-3.3.0 (2018-06-15)
-------------------
+v3.3.0 (2018-06-15)
+-------------------
Features
^^^^^^^^
@@ -247,13 +278,13 @@
* The required `pytest` version changed from >=2.9 to >=3.6.
-3.2.1
------
+v3.2.1
+------
* Fixed automatic deployment to PyPI.
-3.2.0
------
+v3.2.0
+------
Features
^^^^^^^^
@@ -277,8 +308,8 @@
* Support for Django 2.0 has been added.
* Support for Django before 1.8 has been dropped.
-3.1.2
------
+v3.1.2
+------
Bug fixes
^^^^^^^^^
@@ -288,8 +319,8 @@
mentioned in the 3.1.0 release are no longer present. Related issue:
`pytest-django issue
<https://github.com/pytest-dev/pytest-django/issues/433>`__
-3.1.1
------
+v3.1.1
+------
Bug fixes
^^^^^^^^^
@@ -300,8 +331,8 @@
`pytest issue <https://github.com/pytest-dev/pytest/issues/1977>`__,
`Django issue <https://code.djangoproject.com/ticket/27391>`__
-3.1.0
------
+v3.1.0
+------
Features
^^^^^^^^
@@ -328,8 +359,8 @@
mail.outbox = []
-3.0.0
------
+v3.0.0
+------
Bug fixes
^^^^^^^^^
@@ -379,8 +410,8 @@
update your code. See :ref:`advanced-database-configuration` for more
information on the new fixtures and example use cases.
-2.9.1
------
+v2.9.1
+------
Bug fixes
^^^^^^^^^
@@ -390,10 +421,10 @@
<https://github.com/pytest-dev/pytest-django/issues/280>`__.
-2.9.0
------
+v2.9.0
+------
-2.9.0 focus on compatibility with Django 1.9 and master as well as pytest 2.8.1
+v2.9.0 focus on compatibility with Django 1.9 and master as well as pytest
2.8.1
and Python 3.5
Features
@@ -432,8 +463,8 @@
* Drop support for Django 1.3. While pytest-django supports a wide range of
Django versions, extended for Django 1.3 was dropped in february 2013.
-2.8.0
------
+v2.8.0
+------
Features
^^^^^^^^
@@ -452,8 +483,8 @@
`setUpClass`/`setUpTestData`. Django 1.8 is now a fully supported version.
Django master as of 2014-01-18 (the Django 1.9 branch) is also supported.
-2.7.0
------
+v2.7.0
+------
Features
^^^^^^^^
@@ -496,16 +527,16 @@
* ``DJANGO_LIVE_TEST_SERVER_ADDRESS`` environment variable is read instead
of ``DJANGO_TEST_LIVE_SERVER_ADDRESS``. (#140)
-2.6.2
------
+v2.6.2
+------
* Fixed a bug that caused doctests to runs. Thanks to @jjmurre for the patch
* Fixed issue #88 - make sure to use SQLite in memory database when running
with pytest-xdist.
-2.6.1
------
+v2.6.1
+------
This is a bugfix/support release with no new features:
* Added support for Django 1.7 beta and Django master as of 2014-04-16.
@@ -515,22 +546,22 @@
* Support for MySQL with MyISAM tables. Thanks to Zach Kanzler and Julen Ruiz
Aizpuru for fixing this. This fixes issue #8 #64.
-2.6.0
------
+v2.6.0
+------
* Experimental support for Django 1.7 / Django master as of 2014-01-19.
pytest-django is now automatically tested against the latest git version of
Django. The support is experimental since Django 1.7 is not yet released, but
the goal is to always be up to date with the latest Django master
-2.5.1
------
+v2.5.1
+------
Invalid release accidentally pushed to PyPI (identical to 2.6.1). Should not be
used - use 2.6.1 or newer to avoid confusion.
-2.5.0
------
+v2.5.0
+------
* Python 2.5 compatibility dropped. py.test 2.5 dropped support for Python 2.5,
therefore it will be hard to properly support in pytest-django. The same
strategy as for pytest itself is used: No code will be changed to prevent
@@ -540,44 +571,44 @@
pytest-xdist as normal (pass -n to py.test). One database will be created for
each subprocess so that tests run independent from each other.
-2.4.0
------
+v2.4.0
+------
* Support for py.test 2.4 pytest_load_initial_conftests. This makes it possible
to import Django models in project conftest.py files, since pytest-django
will be initialized before the conftest.py is loaded.
-2.3.1
------
+v2.3.1
+------
* Support for Django 1.5 custom user models, thanks to Leonardo Santagada.
-2.3.0
------
+v2.3.0
+------
* Support for configuring settings via django-configurations. Big thanks to
Donald Stufft for this feature!
-2.2.1
------
+v2.2.1
+------
* Fixed an issue with the settings fixture when used in combination with
django-appconf. It now uses pytest's monkeypatch internally and should
be more robust.
-2.2.0
------
+v2.2.0
+------
* Python 3 support. pytest-django now supports Python 3.2 and 3.3 in addition
to 2.5-2.7. Big thanks to Rafal Stozek for making this happen!
-2.1.0
------
+v2.1.0
+------
* Django 1.5 support. pytest-django is now tested against 1.5 for Python
2.6-2.7. This is the first step towards Python 3 support.
-2.0.1
------
+v2.0.1
+------
* Fixed #24/#25: Make it possible to configure Django via
``django.conf.settings.configure()``.
@@ -586,8 +617,8 @@
does not change this setting in the default test runner, so pytest-django
should not do it either.
-2.0.0
------
+v2.0.0
+------
This release is *backward incompatible*. The biggest change is the need
to add the ``pytest.mark.django_db`` to tests which require database
@@ -635,39 +666,39 @@
* Deprecate the ``transaction_test_case`` decorator, this is now
integrated with the ``django_db`` mark.
-1.4
----
+v1.4
+----
* Removed undocumented pytest.load_fixture: If you need this feature, just use
``django.management.call_command('loaddata', 'foo.json')`` instead.
* Fixed issue with RequestFactory in Django 1.3.
* Fixed issue with RequestFactory in Django 1.3.
-1.3
----
+v1.3
+----
* Added ``--reuse-db`` and ``--create-db`` to allow database re-use. Many
thanks to `django-nose <https://github.com/jbalogh/django-nose>`__ for
code and inspiration for this feature.
-1.2.2
------
+v1.2.2
+------
* Fixed Django 1.3 compatibility.
-1.2.1
------
+v1.2.1
+------
* Disable database access and raise errors when using --no-db and accessing
the database by accident.
-1.2
----
+v1.2
+----
* Added the ``--no-db`` command line option.
-1.1.1
------
+v1.1.1
+------
* Flush tables after each test run with transaction_test_case instead of
before.
-1.1
----
+v1.1
+----
* The initial release of this fork from `Ben Firshman original project
<http://github.com/bfirsh/pytest_django>`__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.8.0/docs/database.rst
new/pytest-django-3.9.0/docs/database.rst
--- old/pytest-django-3.8.0/docs/database.rst 2020-01-14 06:19:05.000000000
+0100
+++ new/pytest-django-3.9.0/docs/database.rst 2020-03-31 11:52:21.000000000
+0200
@@ -125,8 +125,8 @@
* When you alter your database schema, run ``pytest --create-db``, to force
re-creation of the test database.
-``--nomigrations`` - Disable Django 1.7+ migrations
---------------------------------------------------------------
+``--nomigrations`` - Disable Django migrations
+----------------------------------------------
Using ``--nomigrations`` will disable Django migrations and create the database
by inspecting all models. It may be faster when there are several migrations to
@@ -401,7 +401,7 @@
"""""""""""""""""""""""""""""""""""""""""""""
By default, each xdist process gets its own database to run tests on. This is
-needed to have transactional tests that does not interfere with eachother.
+needed to have transactional tests that do not interfere with each other.
If you instead want your tests to use the same database, override the
:fixture:`django_db_modify_db_settings` to not do anything. Put this in
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.8.0/pytest_django/plugin.py
new/pytest-django-3.9.0/pytest_django/plugin.py
--- old/pytest-django-3.8.0/pytest_django/plugin.py 2020-01-14
06:19:05.000000000 +0100
+++ new/pytest-django-3.9.0/pytest_django/plugin.py 2020-03-31
11:52:21.000000000 +0200
@@ -12,7 +12,6 @@
import types
import pytest
-from pkg_resources import parse_version
from .django_compat import is_django_unittest # noqa
from .fixtures import django_assert_num_queries # noqa
@@ -53,7 +52,8 @@
PY2 = sys.version_info[0] == 2
# pytest 4.2 handles unittest setup/teardown itself via wrapping fixtures.
-_handle_unittest_methods = parse_version(pytest.__version__) <
parse_version("4.2")
+_pytest_version_info = tuple(int(x) for x in pytest.__version__.split(".",
2)[:2])
+_handle_unittest_methods = _pytest_version_info < (4, 2)
_report_header = []
@@ -63,7 +63,7 @@
def pytest_addoption(parser):
group = parser.getgroup("django")
- group._addoption(
+ group.addoption(
"--reuse-db",
action="store_true",
dest="reuse_db",
@@ -71,7 +71,7 @@
help="Re-use the testing database if it already exists, "
"and do not remove it when the test finishes.",
)
- group._addoption(
+ group.addoption(
"--create-db",
action="store_true",
dest="create_db",
@@ -79,7 +79,7 @@
help="Re-create the database, even if it exists. This "
"option can be used to override --reuse-db.",
)
- group._addoption(
+ group.addoption(
"--ds",
action="store",
type=str,
@@ -87,7 +87,7 @@
default=None,
help="Set DJANGO_SETTINGS_MODULE.",
)
- group._addoption(
+ group.addoption(
"--dc",
action="store",
type=str,
@@ -95,7 +95,7 @@
default=None,
help="Set DJANGO_CONFIGURATION.",
)
- group._addoption(
+ group.addoption(
"--nomigrations",
"--no-migrations",
action="store_true",
@@ -103,7 +103,7 @@
default=False,
help="Disable Django migrations on test setup",
)
- group._addoption(
+ group.addoption(
"--migrations",
action="store_false",
dest="nomigrations",
@@ -113,7 +113,7 @@
parser.addini(
CONFIGURATION_ENV, "django-configurations class to use by
pytest-django."
)
- group._addoption(
+ group.addoption(
"--liveserver",
default=None,
help="Address and port for the live_server fixture.",
@@ -128,7 +128,7 @@
type="bool",
default=True,
)
- group._addoption(
+ group.addoption(
"--fail-on-template-vars",
action="store_true",
dest="itv",
@@ -415,8 +415,22 @@
_disable_class_methods(item.cls)
[email protected](tryfirst=True)
def pytest_collection_modifyitems(items):
+ # If Django is not configured we don't need to bother
+ if not django_settings_is_configured():
+ return
+
+ from django.test import TestCase, TransactionTestCase
+
def get_order_number(test):
+ if hasattr(test, "cls") and test.cls:
+ # Beware, TestCase is a subclass of TransactionTestCase
+ if issubclass(test.cls, TestCase):
+ return 0
+ if issubclass(test.cls, TransactionTestCase):
+ return 1
+
marker_db = test.get_closest_marker('django_db')
if marker_db:
transaction = validate_django_db(marker_db)[0]
@@ -506,20 +520,16 @@
yield
return
- from _pytest.unittest import TestCaseFunction
+ # Fix/patch pytest.
+ # Before pytest 5.4: https://github.com/pytest-dev/pytest/issues/5991
+ # After pytest 5.4: https://github.com/pytest-dev/pytest-django/issues/824
+ from _pytest.monkeypatch import MonkeyPatch
- if "debug" in TestCaseFunction.runtest.__code__.co_names:
- # Fix pytest (https://github.com/pytest-dev/pytest/issues/5991), only
- # if "self._testcase.debug()" is being used (forward compatible).
- from _pytest.monkeypatch import MonkeyPatch
+ def non_debugging_runtest(self):
+ self._testcase(result=self)
- def non_debugging_runtest(self):
- self._testcase(result=self)
-
- mp_debug = MonkeyPatch()
- mp_debug.setattr("_pytest.unittest.TestCaseFunction.runtest",
non_debugging_runtest)
- else:
- mp_debug = None
+ mp_debug = MonkeyPatch()
+ mp_debug.setattr("_pytest.unittest.TestCaseFunction.runtest",
non_debugging_runtest)
request.getfixturevalue("django_db_setup")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.8.0/pytest_django.egg-info/PKG-INFO
new/pytest-django-3.9.0/pytest_django.egg-info/PKG-INFO
--- old/pytest-django-3.8.0/pytest_django.egg-info/PKG-INFO 2020-01-14
06:19:20.000000000 +0100
+++ new/pytest-django-3.9.0/pytest_django.egg-info/PKG-INFO 2020-03-31
11:52:37.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pytest-django
-Version: 3.8.0
+Version: 3.9.0
Summary: A Django plugin for pytest.
Home-page: https://pytest-django.readthedocs.io/
Author: Andreas Pelme
@@ -9,6 +9,7 @@
Maintainer-email: [email protected]
License: BSD-3-Clause
Project-URL: Source, https://github.com/pytest-dev/pytest-django
+Project-URL: Changelog,
https://pytest-django.readthedocs.io/en/latest/changelog.html
Description: .. image::
https://img.shields.io/pypi/v/pytest-django.svg?style=flat
:alt: PyPI Version
:target: https://pypi.python.org/pypi/pytest-django
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.8.0/pytest_django_test/db_helpers.py
new/pytest-django-3.9.0/pytest_django_test/db_helpers.py
--- old/pytest-django-3.8.0/pytest_django_test/db_helpers.py 2020-01-14
06:19:05.000000000 +0100
+++ new/pytest-django-3.9.0/pytest_django_test/db_helpers.py 2020-03-31
11:52:21.000000000 +0200
@@ -61,7 +61,15 @@
pytest.skip("Do not test db reuse since database does not support it")
-def drop_database(name=TEST_DB_NAME):
+def _get_db_name(db_suffix=None):
+ name = TEST_DB_NAME
+ if db_suffix:
+ name = "%s_%s" % (name, db_suffix)
+ return name
+
+
+def drop_database(db_suffix=None):
+ name = _get_db_name(db_suffix)
db_engine = get_db_engine()
if db_engine == "postgresql_psycopg2":
@@ -83,12 +91,9 @@
def db_exists(db_suffix=None):
- name = TEST_DB_NAME
+ name = _get_db_name(db_suffix)
db_engine = get_db_engine()
- if db_suffix:
- name = "%s_%s" % (name, db_suffix)
-
if db_engine == "postgresql_psycopg2":
r = run_cmd("psql", name, "-c", "SELECT 1")
return r.status_code == 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-django-3.8.0/pytest_django_test/settings_base.py
new/pytest-django-3.9.0/pytest_django_test/settings_base.py
--- old/pytest-django-3.8.0/pytest_django_test/settings_base.py 2020-01-14
06:19:05.000000000 +0100
+++ new/pytest-django-3.9.0/pytest_django_test/settings_base.py 2020-03-31
11:52:21.000000000 +0200
@@ -1,5 +1,3 @@
-import os
-
import django
ROOT_URLCONF = "pytest_django_test.urls"
@@ -14,10 +12,6 @@
STATIC_URL = "/static/"
SECRET_KEY = "foobar"
-# Used to construct unique test database names to allow detox to run multiple
-# versions at the same time
-db_suffix = "_%s" % os.getuid()
-
MIDDLEWARE = [
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-django-3.8.0/pytest_django_test/settings_mysql_innodb.py
new/pytest-django-3.9.0/pytest_django_test/settings_mysql_innodb.py
--- old/pytest-django-3.8.0/pytest_django_test/settings_mysql_innodb.py
2020-01-14 06:19:05.000000000 +0100
+++ new/pytest-django-3.9.0/pytest_django_test/settings_mysql_innodb.py
2020-03-31 11:52:21.000000000 +0200
@@ -1,9 +1,9 @@
-from .settings_base import * # noqa: F403
+from .settings_base import * # noqa: F401 F403
DATABASES = {
"default": {
"ENGINE": "django.db.backends.mysql",
- "NAME": "pytest_django" + db_suffix, # noqa: F405
+ "NAME": "pytest_django_should_never_get_accessed",
"HOST": "localhost",
"USER": "root",
"OPTIONS": {"init_command": "SET default_storage_engine=InnoDB"},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-django-3.8.0/pytest_django_test/settings_mysql_myisam.py
new/pytest-django-3.9.0/pytest_django_test/settings_mysql_myisam.py
--- old/pytest-django-3.8.0/pytest_django_test/settings_mysql_myisam.py
2020-01-14 06:19:05.000000000 +0100
+++ new/pytest-django-3.9.0/pytest_django_test/settings_mysql_myisam.py
2020-03-31 11:52:21.000000000 +0200
@@ -1,9 +1,9 @@
-from pytest_django_test.settings_base import * # noqa: F403
+from .settings_base import * # noqa: F401 F403
DATABASES = {
"default": {
"ENGINE": "django.db.backends.mysql",
- "NAME": "pytest_django" + db_suffix, # noqa: F405
+ "NAME": "pytest_django_should_never_get_accessed",
"HOST": "localhost",
"USER": "root",
"OPTIONS": {"init_command": "SET default_storage_engine=MyISAM"},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-django-3.8.0/pytest_django_test/settings_postgres.py
new/pytest-django-3.9.0/pytest_django_test/settings_postgres.py
--- old/pytest-django-3.8.0/pytest_django_test/settings_postgres.py
2020-01-14 06:19:05.000000000 +0100
+++ new/pytest-django-3.9.0/pytest_django_test/settings_postgres.py
2020-03-31 11:52:21.000000000 +0200
@@ -1,4 +1,4 @@
-from pytest_django_test.settings_base import * # noqa
+from .settings_base import * # noqa: F401 F403
# PyPy compatibility
try:
@@ -12,7 +12,7 @@
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
- "NAME": "pytest_django" + db_suffix, # noqa
+ "NAME": "pytest_django_should_never_get_accessed",
"HOST": "localhost",
"USER": "",
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-django-3.8.0/pytest_django_test/settings_sqlite.py
new/pytest-django-3.9.0/pytest_django_test/settings_sqlite.py
--- old/pytest-django-3.8.0/pytest_django_test/settings_sqlite.py
2020-01-14 06:19:05.000000000 +0100
+++ new/pytest-django-3.9.0/pytest_django_test/settings_sqlite.py
2020-03-31 11:52:21.000000000 +0200
@@ -1,4 +1,4 @@
-from .settings_base import * # noqa
+from .settings_base import * # noqa: F401 F403
DATABASES = {
"default": {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-django-3.8.0/pytest_django_test/settings_sqlite_file.py
new/pytest-django-3.9.0/pytest_django_test/settings_sqlite_file.py
--- old/pytest-django-3.8.0/pytest_django_test/settings_sqlite_file.py
2020-01-14 06:19:05.000000000 +0100
+++ new/pytest-django-3.9.0/pytest_django_test/settings_sqlite_file.py
2020-03-31 11:52:21.000000000 +0200
@@ -1,6 +1,6 @@
import tempfile
-from pytest_django_test.settings_base import * # noqa
+from .settings_base import * # noqa: F401 F403
# This is a SQLite configuration, which uses a file based database for
# tests (via setting TEST_NAME / TEST['NAME']).
@@ -11,7 +11,7 @@
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
- "NAME": "/should_never_be_accessed",
+ "NAME": "/pytest_django_should_never_get_accessed",
"TEST": {"NAME": _filename},
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.8.0/setup.py
new/pytest-django-3.9.0/setup.py
--- old/pytest-django-3.8.0/setup.py 2020-01-14 06:19:05.000000000 +0100
+++ new/pytest-django-3.9.0/setup.py 2020-03-31 11:52:21.000000000 +0200
@@ -71,6 +71,7 @@
],
project_urls={
'Source': 'https://github.com/pytest-dev/pytest-django',
+ 'Changelog':
'https://pytest-django.readthedocs.io/en/latest/changelog.html',
},
# the following makes a plugin available to pytest
entry_points={'pytest11': ['django = pytest_django.plugin']})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.8.0/tests/test_db_setup.py
new/pytest-django-3.9.0/tests/test_db_setup.py
--- old/pytest-django-3.8.0/tests/test_db_setup.py 2020-01-14
06:19:05.000000000 +0100
+++ new/pytest-django-3.9.0/tests/test_db_setup.py 2020-03-31
11:52:21.000000000 +0200
@@ -33,7 +33,9 @@
"""Test order in which tests are being executed."""
django_testdir.create_test_module('''
+ from unittest import TestCase
import pytest
+ from django.test import SimpleTestCase, TestCase as DjangoTestCase,
TransactionTestCase
from .app.models import Item
@@ -50,14 +52,34 @@
@pytest.mark.django_db
def test_run_first_decorator():
pass
+
+ class MyTestCase(TestCase):
+ def test_run_last_test_case(self):
+ pass
+
+ class MySimpleTestCase(SimpleTestCase):
+ def test_run_last_simple_test_case(self):
+ pass
+
+ class MyDjangoTestCase(DjangoTestCase):
+ def test_run_first_django_test_case(self):
+ pass
+
+ class MyTransactionTestCase(TransactionTestCase):
+ def test_run_second_transaction_test_case(self):
+ pass
''')
result = django_testdir.runpytest_subprocess('-v', '-s')
assert result.ret == 0
result.stdout.fnmatch_lines([
"*test_run_first_fixture*",
"*test_run_first_decorator*",
+ "*test_run_first_django_test_case*",
"*test_run_second_decorator*",
"*test_run_second_fixture*",
+ "*test_run_second_transaction_test_case*",
+ "*test_run_last_test_case*",
+ "*test_run_last_simple_test_case*",
])
@@ -152,6 +174,8 @@
drop_database("gw0")
drop_database("gw1")
+ assert not db_exists("gw0")
+ assert not db_exists("gw1")
django_testdir.create_test_module(
"""
@@ -214,6 +238,10 @@
result.stdout.fnmatch_lines(["*PASSED*test_c*"])
result.stdout.fnmatch_lines(["*PASSED*test_d*"])
+ # Cleanup.
+ drop_database("gw0")
+ drop_database("gw1")
+
class TestSqliteWithXdist:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.8.0/tests/test_unittest.py
new/pytest-django-3.9.0/tests/test_unittest.py
--- old/pytest-django-3.8.0/tests/test_unittest.py 2020-01-14
06:19:05.000000000 +0100
+++ new/pytest-django-3.9.0/tests/test_unittest.py 2020-03-31
11:52:21.000000000 +0200
@@ -1,7 +1,7 @@
import pytest
from django.test import TestCase
-from pkg_resources import parse_version
+from pytest_django.plugin import _pytest_version_info
from pytest_django_test.app.models import Item
@@ -58,10 +58,11 @@
def test_sole_test(django_testdir):
"""
- Make sure the database are configured when only Django TestCase classes
+ Make sure the database is configured when only Django TestCase classes
are collected, without the django_db marker.
- """
+ Also ensures that the DB is available after a failure (#824).
+ """
django_testdir.create_test_module(
"""
import os
@@ -80,12 +81,27 @@
# Make sure it is usable
assert Item.objects.count() == 0
+
+ assert 0, "trigger_error"
+
+ class TestBar(TestCase):
+ def test_bar(self):
+ assert Item.objects.count() == 0
"""
)
result = django_testdir.runpytest_subprocess("-v")
- result.stdout.fnmatch_lines(["*TestFoo*test_foo PASSED*"])
- assert result.ret == 0
+ result.stdout.fnmatch_lines(
+ [
+ "*::test_foo FAILED",
+ "*::test_bar PASSED",
+ '> assert 0, "trigger_error"',
+ "E AssertionError: trigger_error",
+ "E assert 0",
+ "*= 1 failed, 1 passed in *",
+ ]
+ )
+ assert result.ret == 1
class TestUnittestMethods:
@@ -146,7 +162,7 @@
expected_lines = [
"* ERROR at setup of TestFoo.test_pass *",
]
- if parse_version(pytest.__version__) < parse_version("4.2"):
+ if _pytest_version_info < (4, 2):
expected_lines += [
"E *Failed: <class 'tpkg.test_the_test.TestFoo'>.setUpClass
should be a classmethod", # noqa:E501
]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.8.0/tox.ini
new/pytest-django-3.9.0/tox.ini
--- old/pytest-django-3.8.0/tox.ini 2020-01-14 06:19:05.000000000 +0100
+++ new/pytest-django-3.9.0/tox.ini 2020-03-31 11:52:21.000000000 +0200
@@ -29,6 +29,7 @@
pytest41: pytest>=4.1,<4.2
pytest41: attrs==17.4.0
+ pytest53: pytest>=5.3,<5.4
xdist: pytest-xdist>=1.15
setenv =
@@ -55,6 +56,7 @@
coverage: coverage xml
[testenv:checkqa]
+extras =
deps =
flake8
commands =
@@ -62,6 +64,7 @@
flake8 --statistics {posargs:pytest_django pytest_django_test tests}
[testenv:doc8]
+extras =
basepython = python3.6
skip_install = true
deps =
@@ -76,6 +79,7 @@
commands = sphinx-build -n -W -b html -d docs/_build/doctrees docs
docs/_build/html
[testenv:readme]
+extras =
basepython = python3.5
deps =
readme_renderer