diff --git a/pytest-django-pr996-pytest7.patch b/pytest-django-pr996-pytest7.patch new file mode 100644 index 0000000..f5a68ec --- /dev/null +++ b/pytest-django-pr996-pytest7.patch @@ -0,0 +1,32 @@ +From 458d48aee50171d3dec0ad6c9502bf7d795f9da1 Mon Sep 17 00:00:00 2001 +From: Stanislav Levin +Date: Mon, 28 Feb 2022 13:12:37 +0300 +Subject: [PATCH] tests: Sync expected stream for Pytest's version + +https://docs.pytest.org/en/7.0.x/changelog.html#breaking-changes: +> [pytest#8246](https://github.com/pytest-dev/pytest/issues/8246): --version now writes version information to stdout rather than stderr. + +Fixes: https://github.com/pytest-dev/pytest-django/issues/995 +Signed-off-by: Stanislav Levin +--- + tests/test_manage_py_scan.py | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/tests/test_manage_py_scan.py b/tests/test_manage_py_scan.py +index 39544589..490882b0 100644 +--- a/tests/test_manage_py_scan.py ++++ b/tests/test_manage_py_scan.py +@@ -118,7 +118,12 @@ def test_django_project_found_invalid_settings_version(django_testdir, monkeypat + + result = django_testdir.runpytest_subprocess("django_project_root", "--version", "--version") + assert result.ret == 0 +- result.stderr.fnmatch_lines(["*This is pytest version*"]) ++ if hasattr(pytest, "version_tuple") and pytest.version_tuple >= (7, 0): ++ version_out = result.stdout ++ else: ++ version_out = result.stderr ++ ++ version_out.fnmatch_lines(["*This is pytest version*"]) + + result = django_testdir.runpytest_subprocess("django_project_root", "--help") + assert result.ret == 0 diff --git a/python-pytest-django.changes b/python-pytest-django.changes index 99e7edb..d1a051b 100644 --- a/python-pytest-django.changes +++ b/python-pytest-django.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Mar 28 21:54:21 UTC 2022 - Ben Greiner + +- Add pytest-django-pr996-pytest7.patch + * gh#pytest-dev/pytest-django#996 + ------------------------------------------------------------------- Tue Feb 22 18:40:14 UTC 2022 - Matej Cepl diff --git a/python-pytest-django.spec b/python-pytest-django.spec index 57d4a47..1d5b70a 100644 --- a/python-pytest-django.spec +++ b/python-pytest-django.spec @@ -16,13 +16,12 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%{?!python_module:%define python_module() python3-%{**}} %define skip_python2 1 -%define skip_python36 1 Name: python-pytest-django Version: 4.5.2 Release: 0 -Summary: A Django plugin for py.test +Summary: A Django plugin for Pytest License: BSD-3-Clause URL: https://github.com/pytest-dev/pytest-django Source: https://files.pythonhosted.org/packages/source/p/pytest-django/pytest-django-%{version}.tar.gz @@ -30,6 +29,8 @@ Source: https://files.pythonhosted.org/packages/source/p/pytest-django/p # Protect against non-existant mail.outbox folder # https://stackoverflow.com/q/5424498/164233 Patch0: autoclear_mailbox.patch +# PATCH-FIX-UPSTREAM pytest-django-pr996-pytest7.patch -- gh#pytest-dev/pytest-django#996 +Patch1: https://github.com/pytest-dev/pytest-django/pull/996.patch#/pytest-django-pr996-pytest7.patch BuildRequires: %{python_module Django} BuildRequires: %{python_module pytest > 5.4.0} BuildRequires: %{python_module pytest-xdist} @@ -70,7 +71,7 @@ that are already present in pytest: %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -# memory operations failed in OBS not localy, thus skip them +# memory operations fail in OBS server-side, thus skip them export DJANGO_SETTINGS_MODULE=pytest_django_test.settings_sqlite export PYTHONPATH=$(pwd) %pytest -v tests/ -k 'not (test_sqlite_in_memory_used or test_django_assert_num_queries_db or test_django_assert_max_num_queries_db)'