Accepting request 965500 from home:bnavigator:branches:devel:languages:python:django

- Add pytest-django-pr996-pytest7.patch
  * gh#pytest-dev/pytest-django#996

OBS-URL: https://build.opensuse.org/request/show/965500
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:django/python-pytest-django?expand=0&rev=31
This commit is contained in:
Matej Cepl 2022-03-29 19:46:20 +00:00 committed by Git OBS Bridge
parent 6a54bccfb6
commit 95bfe85a28
3 changed files with 43 additions and 4 deletions

View File

@ -0,0 +1,32 @@
From 458d48aee50171d3dec0ad6c9502bf7d795f9da1 Mon Sep 17 00:00:00 2001
From: Stanislav Levin <slev@altlinux.org>
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 <slev@altlinux.org>
---
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

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Mar 28 21:54:21 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Add pytest-django-pr996-pytest7.patch
* gh#pytest-dev/pytest-django#996
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Feb 22 18:40:14 UTC 2022 - Matej Cepl <mcepl@suse.com> Tue Feb 22 18:40:14 UTC 2022 - Matej Cepl <mcepl@suse.com>

View File

@ -16,13 +16,12 @@
# #
%{?!python_module:%define python_module() python-%{**} python3-%{**}} %{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1 %define skip_python2 1
%define skip_python36 1
Name: python-pytest-django Name: python-pytest-django
Version: 4.5.2 Version: 4.5.2
Release: 0 Release: 0
Summary: A Django plugin for py.test Summary: A Django plugin for Pytest
License: BSD-3-Clause License: BSD-3-Clause
URL: https://github.com/pytest-dev/pytest-django URL: https://github.com/pytest-dev/pytest-django
Source: https://files.pythonhosted.org/packages/source/p/pytest-django/pytest-django-%{version}.tar.gz 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 # Protect against non-existant mail.outbox folder
# https://stackoverflow.com/q/5424498/164233 # https://stackoverflow.com/q/5424498/164233
Patch0: autoclear_mailbox.patch 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 Django}
BuildRequires: %{python_module pytest > 5.4.0} BuildRequires: %{python_module pytest > 5.4.0}
BuildRequires: %{python_module pytest-xdist} BuildRequires: %{python_module pytest-xdist}
@ -70,7 +71,7 @@ that are already present in pytest:
%python_expand %fdupes %{buildroot}%{$python_sitelib} %python_expand %fdupes %{buildroot}%{$python_sitelib}
%check %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 DJANGO_SETTINGS_MODULE=pytest_django_test.settings_sqlite
export PYTHONPATH=$(pwd) 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)' %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)'