Sync from SUSE:SLFO:Main python-testfixtures revision 20b4c24553f5ea8e0c140145b3874c02

This commit is contained in:
Adrian Schröter 2024-10-11 10:09:09 +02:00
parent dc7b196a9e
commit 90ac8e1c98
6 changed files with 176 additions and 22 deletions

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<package>test</package>
</multibuild>

View File

@ -1,3 +1,84 @@
-------------------------------------------------------------------
Tue Oct 1 11:13:06 UTC 2024 - Daniel Garcia <daniel.garcia@suse.com>
- Make Django build-requirement conditional and disable by default for
SUSE:SLFO:Main, bsc#1231124
-------------------------------------------------------------------
Thu Sep 26 04:56:43 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-python-313.patch:
* Support Python 3.13 AttributeError message changes.
-------------------------------------------------------------------
Sun Jun 30 08:18:06 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 8.3.0:
* :class:`ShouldRaise` now supports :class:`ExceptionGroup`.
* Fixed bug where
:func:`~testfixtures.comparison.compare_generator` did not
respect strict=True.
* Fixed bug in the type annotations for :class:`ShouldRaise`
and :func:`~testfixtures.comparison.compare_exception`.
* :class:`LogCapture` will now raise an exception if closed
while still installed. This can be a source of particularly
confusing bugs.
-------------------------------------------------------------------
Wed May 8 06:08:53 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 8.2.0:
* The strict option is now correctly respected when comparing nested
objects.
* When comparing datetime.datetime or datetime.time instances, if the fold
is the only thing that's different, it's now shown in the output.
* A more detailed exception is now raised when resolving a replacement
doesn't give what's expected.
* Replacement of methods on instances is now prevented when strict=True.
* An exception is now raised when mocking and the original is not in the
__dict__ of its containing objects.
* Fix bug where replacement of methods on subclasses failed when using
Replacer.on_class.
* Implement strict comparison as an option for datetime.datetime
and datetime.time.
* Retire zope.component helpers.
* Support bytes in popen.MockPopen commands.
* Allow TempDirectory instances to be traversed as pathlib.Path objects.
* Use the system default encoding where possible in TempDirectory.
* Add TempDirectory option to manage current working directory.
* Allow string class attributes to be replaced with Replacer and friends.
* Fix nasty bug meaning some Replacer.on_class and Replacer.in_module
replacements weren't restored.
* Allow an alternative separator to be used for traversal during replacement
with Replacer and friends.
* Officially support Python 3.12.
* Drop support Python 3.6.
- Add multibuild to break a cycle.
- Drop patch path-comparsion-312.patch, included upstream.
-------------------------------------------------------------------
Mon Dec 11 15:07:33 UTC 2023 - ecsos <ecsos@opensuse.org>
- Add %{?sle15_python_module_pythons}
-------------------------------------------------------------------
Wed Nov 29 01:50:24 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 7.2.2:
* Fix bug in support for :class:`os.PathLike` arguments to
:class:`popen.MockPopen`.
* Added missing support for :class:`os.PathLike` arguments to
:class:`popen.MockPopen`.
* Add ``order_matters`` parameter to :class:`ShouldWarn`.
* Implement new IDE and static-analysis ways of :doc:`mocking <mocking>`
including additional parameters to :meth:`~Replacer.replace` along with
the :any:`replace_on_class`, :any:`replace_in_module` and
:any:`replace_in_environ` context managers.
- Add patch path-comparsion-312.patch:
* Compare paths string-wise, due to Python 3.12 changes.
- Switch to autosetup and pyproject macros.
- Remove now unneeded Python 3.6 special-casing.
-------------------------------------------------------------------
Tue Dec 13 17:36:55 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-testfixtures
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -16,27 +16,53 @@
#
%define skip_python2 1
Name: python-testfixtures
Version: 7.0.4
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
%if 0%{?suse_version} == 1600
# No django in SLFO:Main
%bcond_with django
%else
%bcond_without django
%endif
%{?sle15_python_module_pythons}
Name: python-testfixtures%{psuffix}
Version: 8.3.0
Release: 0
Summary: A collection of helpers and mock objects for unit tests and doc tests
License: MIT
URL: https://github.com/Simplistix/testfixtures
Source: https://files.pythonhosted.org/packages/source/t/testfixtures/testfixtures-%{version}.tar.gz
# PATCH-FIX-UPSTREAM gh#simplistix/testfixtures#202
Patch0: support-python-313.patch
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
%if %{with test}
%if %{with django}
BuildRequires: %{python_module Django}
BuildRequires: %{python_module pytest-django}
%endif
BuildRequires: %{python_module Twisted}
BuildRequires: %{python_module pytest >= 3.6}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module sybil >= 3}
BuildRequires: %{python_module zope.component}
BuildRequires: %{python_module sybil >= 6}
BuildRequires: %{python_module testfixtures = %{version}}
%endif
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: %{python_module Django if (%python-base without python36-base)}
BuildRequires: %{python_module pytest-django if (%python-base without python36-base)}
Suggests: python-Django
Suggests: python-Twisted
Suggests: python-sybil >= 3
Suggests: python-zope.component
Suggests: python-sybil >= 6
BuildArch: noarch
%python_subpackages
@ -52,28 +78,36 @@ repeating from package to package and so decided to extract them into
their own library and give them some tests of their own!
%prep
%setup -q -n testfixtures-%{version}
%autopatch -p1
%autosetup -p1 -n testfixtures-%{version}
chmod a-x docs/*.txt
%build
%python_build
%pyproject_wheel
%install
%python_install
%if %{without test}
%pyproject_install
%python_expand rm -r %{buildroot}%{$python_sitelib}/testfixtures/tests
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif
%check
export DJANGO_SETTINGS_MODULE=testfixtures.tests.test_django.settings
%if %{with test}
export PYTHONPATH=$(pwd)
python36_flags="--ignore testfixtures/tests/test_django"
%pytest testfixtures/tests ${$python_flags}
%if %{with django}
export DJANGO_SETTINGS_MODULE=testfixtures.tests.test_django.settings
%else
test_flags="--ignore=testfixtures/tests/test_django"
%endif
%pytest $test_flags testfixtures/tests
%endif
%if %{without test}
%files %{python_files}
%license LICENSE.txt
%doc README.rst docs/*.txt
%{python_sitelib}/testfixtures
%{python_sitelib}/testfixtures-%{version}*-info
%{python_sitelib}/testfixtures-%{version}.dist-info
%endif
%changelog

36
support-python-313.patch Normal file
View File

@ -0,0 +1,36 @@
From 291850017e9154b4219fc35d8eca3551724bef94 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Thu, 26 Sep 2024 14:50:58 +1000
Subject: [PATCH] Support Python 3.13's AttributeError changes
Python 3.13 has changed the message that is raised with an
AttributeError to provide a hint on how to help avoid it -- but this
breaks a test case. Support both the old and the new message.
---
testfixtures/tests/test_replace.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/testfixtures/tests/test_replace.py b/testfixtures/tests/test_replace.py
index 073e43c..863981b 100644
--- a/testfixtures/tests/test_replace.py
+++ b/testfixtures/tests/test_replace.py
@@ -15,6 +15,7 @@
from unittest import TestCase
import os
+import sys
from testfixtures.mock import Mock
from testfixtures.tests import sample1, sample3
@@ -1362,7 +1363,10 @@ def test_invalid_attribute_on_instance_of_slotted_class(self):
obj = OriginE()
assert not hasattr(obj, '__dict__')
replace_ = Replacer()
- with ShouldRaise(AttributeError("'OriginE' object has no attribute 'bad'")):
+ msg = "'OriginE' object has no attribute 'bad'"
+ if sys.version_info >= (3, 13):
+ msg += " and no __dict__ for setting new attributes"
+ with ShouldRaise(AttributeError(msg)):
replace_(obj, name='bad', replacement=42, strict=self.strict)
def test_method_on_instance_of_slotted_subclass(self):

BIN
testfixtures-7.0.4.tar.gz (Stored with Git LFS)

Binary file not shown.

BIN
testfixtures-8.3.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.