Accepting request 956874 from home:mcepl:branches:devel:languages:python

- Add autoclear_mailbox.patch checking for the existence of the
  mail.outbox before clearing it (gh#pytest-dev/pytest-django#993).

OBS-URL: https://build.opensuse.org/request/show/956874
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:django/python-pytest-django?expand=0&rev=30
This commit is contained in:
Matej Cepl 2022-02-22 21:28:13 +00:00 committed by Git OBS Bridge
parent c1a65e39b5
commit 6a54bccfb6
3 changed files with 28 additions and 2 deletions

16
autoclear_mailbox.patch Normal file
View File

@ -0,0 +1,16 @@
---
pytest_django/plugin.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/pytest_django/plugin.py
+++ b/pytest_django/plugin.py
@@ -502,7 +502,8 @@ def _dj_autoclear_mailbox() -> None:
from django.core import mail
- del mail.outbox[:]
+ if hasattr(mail, "outbox"):
+ del mail.outbox[:]
@pytest.fixture(scope="function")

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Feb 22 18:40:14 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Add autoclear_mailbox.patch checking for the existence of the
mail.outbox before clearing it (gh#pytest-dev/pytest-django#993).
-------------------------------------------------------------------
Mon Dec 27 15:43:56 UTC 2021 - Ben Greiner <code@bnavigator.de>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-pytest-django
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -26,6 +26,10 @@ Summary: A Django plugin for py.test
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
# PATCH-FIX-UPSTREAM autoclear_mailbox.patch gh#pytest-dev/pytest-django#993 mcepl@suse.com
# Protect against non-existant mail.outbox folder
# https://stackoverflow.com/q/5424498/164233
Patch0: autoclear_mailbox.patch
BuildRequires: %{python_module Django}
BuildRequires: %{python_module pytest > 5.4.0}
BuildRequires: %{python_module pytest-xdist}
@ -56,7 +60,7 @@ that are already present in pytest:
* Works with both worlds: Existing unittest-style TestCase's still work without any modifications.
%prep
%setup -q -n pytest-django-%{version}
%autosetup -p1 -n pytest-django-%{version}
%build
%python_build