mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-10 22:00:09 +02:00
nose: clean up, support Python 3.10. (#8825)
Due to changes in setuptools, we need to run 2to3 ourselves. While we're at it, lets apply relevant patches from Debian. https://salsa.debian.org/python-team/packages/nose/
This commit is contained in:
167
dev-python/nose/patches/debian/python3.11-testcase-str.diff
Normal file
167
dev-python/nose/patches/debian/python3.11-testcase-str.diff
Normal file
@@ -0,0 +1,167 @@
|
||||
From: Dmitry Shachnev <mitya57@debian.org>
|
||||
Date: Tue, 13 Dec 2022 15:08:11 +0300
|
||||
Subject: Update tests to adapt for TestCase.__str__ change in Python 3.11
|
||||
|
||||
See https://github.com/python/cpython/issues/58473.
|
||||
---
|
||||
.../doc_tests/test_issue145/imported_tests.rst | 14 +++++++-------
|
||||
.../doc_tests/test_selector_plugin/selector_plugin.rst | 10 +++++-----
|
||||
functional_tests/test_attribute_plugin.py | 4 ++--
|
||||
functional_tests/test_load_tests_from_test_case.py | 12 +++++++++---
|
||||
functional_tests/test_xunit.py | 2 +-
|
||||
nose/plugins/errorclass.py | 4 ++--
|
||||
6 files changed, 26 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/functional_tests/doc_tests/test_issue145/imported_tests.rst b/functional_tests/doc_tests/test_issue145/imported_tests.rst
|
||||
index c4eee78..8d0a7c6 100644
|
||||
--- a/functional_tests/doc_tests/test_issue145/imported_tests.rst
|
||||
+++ b/functional_tests/doc_tests/test_issue145/imported_tests.rst
|
||||
@@ -40,13 +40,13 @@ below that the test names reflect the modules into which the tests are
|
||||
imported, not the source modules.
|
||||
|
||||
>>> argv = [__file__, '-v', support]
|
||||
- >>> run(argv=argv) # doctest: +REPORT_NDIFF
|
||||
+ >>> run(argv=argv) # doctest: +REPORT_NDIFF, +ELLIPSIS
|
||||
package1 setup
|
||||
- test (package1.test_module.TestCase) ... ok
|
||||
+ test (package1.test_module.TestCase...) ... ok
|
||||
package1.test_module.TestClass.test_class ... ok
|
||||
package1.test_module.test_function ... ok
|
||||
package2c setup
|
||||
- test (package2c.test_module.TestCase) ... ok
|
||||
+ test (package2c.test_module.TestCase...) ... ok
|
||||
package2c.test_module.TestClass.test_class ... ok
|
||||
package2f setup
|
||||
package2f.test_module.test_function ... ok
|
||||
@@ -69,9 +69,9 @@ packages are executed.
|
||||
<BLANKLINE>
|
||||
OK
|
||||
>>> argv = [__file__, '-v', os.path.join(support, 'package2c')]
|
||||
- >>> run(argv=argv) # doctest: +REPORT_NDIFF
|
||||
+ >>> run(argv=argv) # doctest: +REPORT_NDIFF, +ELLIPSIS
|
||||
package2c setup
|
||||
- test (package2c.test_module.TestCase) ... ok
|
||||
+ test (package2c.test_module.TestCase...) ... ok
|
||||
package2c.test_module.TestClass.test_class ... ok
|
||||
<BLANKLINE>
|
||||
----------------------------------------------------------------------
|
||||
@@ -96,9 +96,9 @@ command-line.
|
||||
>>> argv = [__file__, '-v',
|
||||
... os.path.join(support, 'package2c', 'test_module.py') +
|
||||
... ':TestCase.test']
|
||||
- >>> run(argv=argv) # doctest: +REPORT_NDIFF
|
||||
+ >>> run(argv=argv) # doctest: +REPORT_NDIFF, +ELLIPSIS
|
||||
package2c setup
|
||||
- test (package2c.test_module.TestCase) ... ok
|
||||
+ test (package2c.test_module.TestCase...) ... ok
|
||||
<BLANKLINE>
|
||||
----------------------------------------------------------------------
|
||||
Ran 1 test in ...s
|
||||
diff --git a/functional_tests/doc_tests/test_selector_plugin/selector_plugin.rst b/functional_tests/doc_tests/test_selector_plugin/selector_plugin.rst
|
||||
index f5f7913..b01d665 100644
|
||||
--- a/functional_tests/doc_tests/test_selector_plugin/selector_plugin.rst
|
||||
+++ b/functional_tests/doc_tests/test_selector_plugin/selector_plugin.rst
|
||||
@@ -107,11 +107,11 @@ the test loader.
|
||||
Now we can execute a test run using the custom selector, and the
|
||||
project's tests will be collected.
|
||||
|
||||
- >>> run(argv=argv, plugins=[UseMySelector()])
|
||||
- test_add (basic.TestBasicMath) ... ok
|
||||
- test_sub (basic.TestBasicMath) ... ok
|
||||
- test_tuple_groups (my_function.MyFunction) ... ok
|
||||
- test_cat (cat.StringsCat) ... ok
|
||||
+ >>> run(argv=argv, plugins=[UseMySelector()]) # doctest: +ELLIPSIS
|
||||
+ test_add (basic.TestBasicMath...) ... ok
|
||||
+ test_sub (basic.TestBasicMath...) ... ok
|
||||
+ test_tuple_groups (my_function.MyFunction...) ... ok
|
||||
+ test_cat (cat.StringsCat...) ... ok
|
||||
<BLANKLINE>
|
||||
----------------------------------------------------------------------
|
||||
Ran 4 tests in ...s
|
||||
diff --git a/functional_tests/test_attribute_plugin.py b/functional_tests/test_attribute_plugin.py
|
||||
index c9bab66..5b0bf14 100644
|
||||
--- a/functional_tests/test_attribute_plugin.py
|
||||
+++ b/functional_tests/test_attribute_plugin.py
|
||||
@@ -150,7 +150,7 @@ class TestClassAndMethodAttrs(AttributePluginTester):
|
||||
args = ["-a", "meth_attr=method,cls_attr=class"]
|
||||
|
||||
def verify(self):
|
||||
- assert '(test_attr.TestClassAndMethodAttrs) ... ok' in self.output
|
||||
+ assert '(test_attr.TestClassAndMethodAttrs' in self.output
|
||||
assert 'test_case_two' not in self.output
|
||||
assert 'test_case_one' not in self.output
|
||||
assert 'test_case_three' not in self.output
|
||||
@@ -166,7 +166,7 @@ class TestTopLevelNotSelected(AttributePluginTester):
|
||||
# rather than the attribute plugin, but the issue more easily manifests
|
||||
# itself when using attributes.
|
||||
assert 'test.test_b ... ok' in self.output
|
||||
- assert 'test_a (test.TestBase) ... ok' in self.output
|
||||
+ assert 'test_a (test.TestBase' in self.output
|
||||
assert 'TestDerived' not in self.output
|
||||
|
||||
|
||||
diff --git a/functional_tests/test_load_tests_from_test_case.py b/functional_tests/test_load_tests_from_test_case.py
|
||||
index 13d0c8a..934d43b 100644
|
||||
--- a/functional_tests/test_load_tests_from_test_case.py
|
||||
+++ b/functional_tests/test_load_tests_from_test_case.py
|
||||
@@ -2,6 +2,7 @@
|
||||
Tests that plugins can override loadTestsFromTestCase
|
||||
"""
|
||||
import os
|
||||
+import sys
|
||||
import unittest
|
||||
from nose import loader
|
||||
from nose.plugins import PluginTester
|
||||
@@ -44,9 +45,14 @@ class TestLoadTestsFromTestCaseHook(PluginTester, unittest.TestCase):
|
||||
suitepath = os.path.join(support, 'ltftc')
|
||||
|
||||
def runTest(self):
|
||||
- expect = [
|
||||
- 'test_value (%s.Derived) ... ERROR' % __name__,
|
||||
- 'test_value (tests.Tests) ... ok']
|
||||
+ if sys.version_info >= (3, 11):
|
||||
+ expect = [
|
||||
+ 'test_value (%s.Derived.test_value) ... ERROR' % __name__,
|
||||
+ 'test_value (tests.Tests.test_value) ... ok']
|
||||
+ else:
|
||||
+ expect = [
|
||||
+ 'test_value (%s.Derived) ... ERROR' % __name__,
|
||||
+ 'test_value (tests.Tests) ... ok']
|
||||
print str(self.output)
|
||||
for line in self.output:
|
||||
if expect:
|
||||
diff --git a/functional_tests/test_xunit.py b/functional_tests/test_xunit.py
|
||||
index 6c2e99d..d9db8c1 100644
|
||||
--- a/functional_tests/test_xunit.py
|
||||
+++ b/functional_tests/test_xunit.py
|
||||
@@ -25,7 +25,7 @@ class TestXUnitPlugin(PluginTester, unittest.TestCase):
|
||||
|
||||
assert "ERROR: test_error" in self.output
|
||||
assert "FAIL: test_fail" in self.output
|
||||
- assert "test_skip (test_xunit_as_suite.TestForXunit) ... SKIP: skipit" in self.output
|
||||
+ assert "SKIP: skipit" in self.output
|
||||
assert "XML: %s" % xml_results_filename in self.output
|
||||
|
||||
f = codecs.open(xml_results_filename,'r', encoding='utf8')
|
||||
diff --git a/nose/plugins/errorclass.py b/nose/plugins/errorclass.py
|
||||
index d1540e0..8c11e0a 100644
|
||||
--- a/nose/plugins/errorclass.py
|
||||
+++ b/nose/plugins/errorclass.py
|
||||
@@ -66,7 +66,7 @@ each step.
|
||||
Now run the test. TODO is printed.
|
||||
|
||||
>>> _ = case(result) # doctest: +ELLIPSIS
|
||||
- runTest (....TestTodo) ... TODO: I need to test something
|
||||
+ runTest (....TestTodo...) ... TODO: I need to test something
|
||||
|
||||
Errors and failures are empty, but todo has our test:
|
||||
|
||||
@@ -79,7 +79,7 @@ Errors and failures are empty, but todo has our test:
|
||||
>>> result.printErrors() # doctest: +ELLIPSIS
|
||||
<BLANKLINE>
|
||||
======================================================================
|
||||
- TODO: runTest (....TestTodo)
|
||||
+ TODO: runTest (....TestTodo...)
|
||||
----------------------------------------------------------------------
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
Reference in New Issue
Block a user