From d6f003cfa6b58ded2358a6ef0a948d696a847793dd6dcf72d151bda72d71a73b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Wed, 2 Sep 2020 13:27:37 +0000 Subject: [PATCH] Accepting request 831464 from home:bnavigator:pytest6 - Fix test failure with pytest 6 * pytest-django-pytest6.patch * The patched call signature looks weird, but it works as intended * Patch is part of gh#pytest-dev/pytest-django#855 - Replace deprecated py.test call with %pytest macro OBS-URL: https://build.opensuse.org/request/show/831464 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:django/python-pytest-django?expand=0&rev=25 --- pytest-django-pytest6.patch | 22 ++++++++++++++++++++++ python-pytest-django.changes | 9 +++++++++ python-pytest-django.spec | 6 +++++- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 pytest-django-pytest6.patch diff --git a/pytest-django-pytest6.patch b/pytest-django-pytest6.patch new file mode 100644 index 0000000..fc1c091 --- /dev/null +++ b/pytest-django-pytest6.patch @@ -0,0 +1,22 @@ +From 3f03d0a7890e987086042b42db346e47398ffed3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20K=C3=A4ufl?= +Date: Sun, 2 Aug 2020 10:41:31 +0200 +Subject: [PATCH] Fix compat with pytest 6 + +--- + tests/test_manage_py_scan.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/test_manage_py_scan.py b/tests/test_manage_py_scan.py +index 8a0f9aad..a11f87c2 100644 +--- a/tests/test_manage_py_scan.py ++++ b/tests/test_manage_py_scan.py +@@ -116,7 +116,7 @@ def test_django_project_found_invalid_settings_version(django_testdir, monkeypat + """Invalid DSM should not cause an error with --help or --version.""" + monkeypatch.setenv("DJANGO_SETTINGS_MODULE", "DOES_NOT_EXIST") + +- result = django_testdir.runpytest_subprocess("django_project_root", "--version") ++ result = django_testdir.runpytest_subprocess("django_project_root", "--version", "--version") + assert result.ret == 0 + result.stderr.fnmatch_lines(["*This is pytest version*"]) + diff --git a/python-pytest-django.changes b/python-pytest-django.changes index 48a771a..1ae1e71 100644 --- a/python-pytest-django.changes +++ b/python-pytest-django.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed Sep 2 13:19:37 UTC 2020 - Benjamin Greiner + +- Fix test failure with pytest 6 + * pytest-django-pytest6.patch + * The patched call signature looks weird, but it works as intended + * Patch is part of gh#pytest-dev/pytest-django#855 +- Replace deprecated py.test call with %pytest macro + ------------------------------------------------------------------- Mon Aug 24 11:50:24 UTC 2020 - Marketa Calabkova diff --git a/python-pytest-django.spec b/python-pytest-django.spec index 74bf4a7..b9123c9 100644 --- a/python-pytest-django.spec +++ b/python-pytest-django.spec @@ -27,6 +27,8 @@ URL: https://github.com/pytest-dev/pytest-django Source: https://files.pythonhosted.org/packages/source/p/pytest-django/pytest-django-%{version}.tar.gz # fix tests Patch0: ignore-warnings.patch +# PATCH-FIX-UPSTREAM fix test failure with pytest 6, is part of https://github.com/pytest-dev/pytest-django/pull/855 +Patch1: https://github.com/pytest-dev/pytest-django/commit/3f03d0a7890e987086042b42db346e47398ffed3.patch#/pytest-django-pytest6.patch BuildRequires: %{python_module Django} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools_scm >= 1.11.1} @@ -64,6 +66,7 @@ that are already present in pytest: %prep %setup -q -n pytest-django-%{version} %patch0 -p1 +%patch1 -p1 %build %python_build @@ -75,7 +78,8 @@ that are already present in pytest: %check # memory operations failed in OBS not localy, thus skip them export DJANGO_SETTINGS_MODULE=pytest_django_test.settings_sqlite -%python_expand PYTHONPATH=$(pwd) py.test-%{$python_bin_suffix} -v tests/ -k 'not (test_sqlite_in_memory_used or test_django_assert_num_queries_db or test_django_assert_max_num_queries_db)' +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)' %files %{python_files} %license LICENSE