14
0
forked from pool/python-nose2

- Update to 0.14.0;

* Add official support for python3.12
  * Remove support for python3.6 and python3.7
  * Remove support for python2 and older python3 versions
  * Fix support for python3.12 to avoid warnings about addDuration.
  * nose2 package metadata is converted to pyproject.toml format, using
    setuptools.
  * nose2 license metadata has been corrected in format and content to be
    distributed in the sdist and wheel distributions correctly.
- Add patch support-python312.patch:
  * Support changes made upstream in Python 3.12.1.
- Switch to autosetup macro.
- Instruct pip it isn't allowed to reach PyPi and teach it where to look for
  wheels.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-nose2?expand=0&rev=25
This commit is contained in:
2024-01-08 05:40:45 +00:00
committed by Git OBS Bridge
parent 9b21ca886d
commit 87c0f61994
6 changed files with 145 additions and 10 deletions

BIN
nose2-0.12.0.tar.gz (Stored with Git LFS)

Binary file not shown.

3
nose2-0.14.0.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5c28d770a0b9a702862bd6c3755ba2cd2f7994dd518c982e5ce298d7f37466a4
size 167278

View File

@@ -1,3 +1,21 @@
-------------------------------------------------------------------
Mon Jan 8 05:39:22 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 0.14.0;
* Add official support for python3.12
* Remove support for python3.6 and python3.7
* Remove support for python2 and older python3 versions
* Fix support for python3.12 to avoid warnings about addDuration.
* nose2 package metadata is converted to pyproject.toml format, using
setuptools.
* nose2 license metadata has been corrected in format and content to be
distributed in the sdist and wheel distributions correctly.
- Add patch support-python312.patch:
* Support changes made upstream in Python 3.12.1.
- Switch to autosetup macro.
- Instruct pip it isn't allowed to reach PyPi and teach it where to look for
wheels.
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Apr 21 12:28:30 UTC 2023 - Dirk Müller <dmueller@suse.com> Fri Apr 21 12:28:30 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@@ -1,7 +1,7 @@
# #
# spec file for package python-nose2 # spec file for package python-nose2
# #
# Copyright (c) 2023 SUSE LLC # Copyright (c) 2024 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@@ -16,17 +16,21 @@
# #
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%{?sle15_python_module_pythons} %{?sle15_python_module_pythons}
Name: python-nose2 Name: python-nose2
Version: 0.12.0 Version: 0.14.0
Release: 0 Release: 0
Summary: The successor to the Python testing framework nose, based on unittest Summary: The successor to the Python testing framework nose, based on unittest
License: BSD-2-Clause AND Python-2.0 License: BSD-2-Clause AND Python-2.0
URL: https://github.com/nose-devs/nose2 URL: https://github.com/nose-devs/nose2
Source: https://files.pythonhosted.org/packages/source/n/nose2/nose2-%{version}.tar.gz Source: https://files.pythonhosted.org/packages/source/n/nose2/nose2-%{version}.tar.gz
# Required for testsuite. Bring on python-wheel-wheel
Source1: https://files.pythonhosted.org/packages/c7/c3/55076fc728723ef927521abaa1955213d094933dc36d4a2008d5101e1af5/wheel-0.42.0-py3-none-any.whl
# PATCH-FIX-UPSTREAM Based on gh#nose-devs/nose2#593
Patch0: support-python312.patch
BuildRequires: %{python_module coverage} BuildRequires: %{python_module coverage}
BuildRequires: %{python_module pip} BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools-wheel}
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel} BuildRequires: %{python_module wheel}
BuildRequires: fdupes BuildRequires: fdupes
@@ -43,7 +47,9 @@ nose2 is a new project and does not support all of the behaviors of nose.
nose2's purpose is to extend unittest to make testing nicer and easier to understand. nose2's purpose is to extend unittest to make testing nicer and easier to understand.
%prep %prep
%setup -q -n nose2-%{version} %autosetup -p1 -n nose2-%{version}
mkdir ../wheels
cp %{SOURCE1} ../wheels
%build %build
%pyproject_wheel %pyproject_wheel
@@ -59,7 +65,7 @@ export LC_CTYPE=C.UTF8
%{python_expand # nose must test itself in an editable install %{python_expand # nose must test itself in an editable install
$python -m venv editable-%{$python_bin_suffix} --system-site-packages $python -m venv editable-%{$python_bin_suffix} --system-site-packages
. editable-%{$python_bin_suffix}/bin/activate . editable-%{$python_bin_suffix}/bin/activate
pip install -e . pip install --no-index --find-links /usr/lib/python%{$python_bin_suffix}/wheels --find-links ../wheels -e .
nose2 -v --pretty-assert nose2 -v --pretty-assert
deactivate deactivate
} }
@@ -71,10 +77,10 @@ deactivate
%python_uninstall_alternative nose2 %python_uninstall_alternative nose2
%files %{python_files} %files %{python_files}
%license license.txt %license LICENSE
%doc AUTHORS README.rst %doc AUTHORS README.rst
%python_alternative %{_bindir}/nose2 %python_alternative %{_bindir}/nose2
%{python_sitelib}/nose2 %{python_sitelib}/nose2
%{python_sitelib}/nose2-%{version}*-info %{python_sitelib}/nose2-%{version}.dist-info
%changelog %changelog

108
support-python312.patch Normal file
View File

@@ -0,0 +1,108 @@
From 58cbe5ff35e2cc0633e7ff7c46d48a66d597a025 Mon Sep 17 00:00:00 2001
From: Stephen Rosen <sirosen@globus.org>
Date: Thu, 21 Dec 2023 20:25:22 -0600
Subject: [PATCH 1/2] Fix verbose reporting of skipped tests
On 3.12.1+, unittest doesn't call `startTest` for skipped tests. This
is treated as a fix to how tests are counted, which is why it appeared
in a point release.
Because the nose2 path for test reporting uses the test result methods
as the point of connection between `unittest` and nose2 plugins,
losing the `startTest` call in this case means that the reporter
plugin doesn't emit proper output.
The test result object now tracks whether or not a test has been
started, and the reporter will check this attribute to ensure that the
skipped test output is correct.
---
docs/changelog.rst | 6 ++++++
nose2/plugins/result.py | 12 +++++++++---
nose2/result.py | 4 ++++
nose2/tests/functional/test_junitxml_plugin.py | 2 +-
4 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 18ec30f5..5e1c46c1 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -13,6 +13,12 @@ testsuites.
Unreleased
----------
+* Fix the reporting of skipped tests in verbose mode on newer pythons (3.12.1+),
+ in which a skipped test is no longer treated as "started".
+
+ ``nose2`` will not introduce a ``StartTestEvent`` in such cases --
+ the fix is narrowly and adjustment to the test reporter.
+
0.14.0 (2023-10-04)
-------------------
diff --git a/nose2/plugins/result.py b/nose2/plugins/result.py
index fe953129..fb95ec7a 100644
--- a/nose2/plugins/result.py
+++ b/nose2/plugins/result.py
@@ -80,6 +80,9 @@ def testOutcome(self, event):
etc)
"""
+ if not event.result.test_started:
+ self._show_test_description(self.stream, event.test)
+
if event.outcome == result.ERROR:
self.reportCategories["errors"].append(event)
self._reportError(event)
@@ -145,11 +148,14 @@ def _reportStartTest(self, event):
self.session.hooks.reportStartTest(evt)
if evt.handled:
return
+ self._show_test_description(evt.stream, event.test)
+
+ def _show_test_description(self, stream, test):
if self.session.verbosity > 1:
# allow other plugins to override/spy on stream
- evt.stream.write(self._getDescription(event.test, errorList=False))
- evt.stream.write(" ... ")
- evt.stream.flush()
+ stream.write(self._getDescription(test, errorList=False))
+ stream.write(" ... ")
+ stream.flush()
def _reportError(self, event):
self._report(event, "reportError", "E", "ERROR")
diff --git a/nose2/result.py b/nose2/result.py
index 48adc22a..fe19e8b1 100644
--- a/nose2/result.py
+++ b/nose2/result.py
@@ -31,6 +31,9 @@ def __init__(self, session):
self.shouldStop = False
# XXX TestCase.subTest expects a result.failfast attribute
self.failfast = False
+ # track whether or not the test actually started
+ # (in py3.12.1+ a skipped test is not started)
+ self.test_started = False
def startTest(self, test):
"""Start a test case.
@@ -40,6 +43,7 @@ def startTest(self, test):
"""
event = events.StartTestEvent(test, self, time.time())
self.session.hooks.startTest(event)
+ self.test_started = True
def stopTest(self, test):
"""Stop a test case.
diff --git a/nose2/tests/functional/test_junitxml_plugin.py b/nose2/tests/functional/test_junitxml_plugin.py
index acd175d8..1b289dd2 100644
--- a/nose2/tests/functional/test_junitxml_plugin.py
+++ b/nose2/tests/functional/test_junitxml_plugin.py
@@ -161,7 +161,7 @@ def test_skip_reason_in_message(self):
self.assertTestRunOutputMatches(
proc,
- stderr=r"test \(test_junitxml_skip_reason.Test"
+ stderr=r"test \(test_junitxml_skip_reason\.Test"
+ _method_name()
+ r"\) \.* skip",
)

BIN
wheel-0.42.0-py3-none-any.whl (Stored with Git LFS) Normal file

Binary file not shown.