102.11.0-1
[arch-packages.git] / python-nose / repos / extra-any / python-nose-py311.patch
blob66ff3458fb0f9a36722fb98e20772b7521ac4382
1 diff --git a/functional_tests/test_attribute_plugin.py b/functional_tests/test_attribute_plugin.py
2 index c9bab66..df2cfd3 100644
3 --- a/functional_tests/test_attribute_plugin.py
4 +++ b/functional_tests/test_attribute_plugin.py
5 @@ -150,7 +150,10 @@ class TestClassAndMethodAttrs(AttributePluginTester):
6 args = ["-a", "meth_attr=method,cls_attr=class"]
8 def verify(self):
9 - assert '(test_attr.TestClassAndMethodAttrs) ... ok' in self.output
10 + if sys.version_info >= (3, 11):
11 + assert '(test_attr.TestClassAndMethodAttrs.test_method) ... ok' in self.output
12 + else:
13 + assert '(test_attr.TestClassAndMethodAttrs) ... ok' in self.output
14 assert 'test_case_two' not in self.output
15 assert 'test_case_one' not in self.output
16 assert 'test_case_three' not in self.output
17 @@ -166,7 +169,10 @@ class TestTopLevelNotSelected(AttributePluginTester):
18 # rather than the attribute plugin, but the issue more easily manifests
19 # itself when using attributes.
20 assert 'test.test_b ... ok' in self.output
21 - assert 'test_a (test.TestBase) ... ok' in self.output
22 + if sys.version_info >= (3, 11):
23 + assert 'test_a (test.TestBase.test_a) ... ok' in self.output
24 + else:
25 + assert 'test_a (test.TestBase) ... ok' in self.output
26 assert 'TestDerived' not in self.output
29 diff --git a/functional_tests/test_load_tests_from_test_case.py b/functional_tests/test_load_tests_from_test_case.py
30 index 13d0c8a..934d43b 100644
31 --- a/functional_tests/test_load_tests_from_test_case.py
32 +++ b/functional_tests/test_load_tests_from_test_case.py
33 @@ -2,6 +2,7 @@
34 Tests that plugins can override loadTestsFromTestCase
35 """
36 import os
37 +import sys
38 import unittest
39 from nose import loader
40 from nose.plugins import PluginTester
41 @@ -44,9 +45,14 @@ class TestLoadTestsFromTestCaseHook(PluginTester, unittest.TestCase):
42 suitepath = os.path.join(support, 'ltftc')
44 def runTest(self):
45 - expect = [
46 - 'test_value (%s.Derived) ... ERROR' % __name__,
47 - 'test_value (tests.Tests) ... ok']
48 + if sys.version_info >= (3, 11):
49 + expect = [
50 + 'test_value (%s.Derived.test_value) ... ERROR' % __name__,
51 + 'test_value (tests.Tests.test_value) ... ok']
52 + else:
53 + expect = [
54 + 'test_value (%s.Derived) ... ERROR' % __name__,
55 + 'test_value (tests.Tests) ... ok']
56 print str(self.output)
57 for line in self.output:
58 if expect:
59 diff --git a/functional_tests/test_xunit.py b/functional_tests/test_xunit.py
60 index 6c2e99d..6e76a7d 100644
61 --- a/functional_tests/test_xunit.py
62 +++ b/functional_tests/test_xunit.py
63 @@ -25,7 +25,10 @@ class TestXUnitPlugin(PluginTester, unittest.TestCase):
65 assert "ERROR: test_error" in self.output
66 assert "FAIL: test_fail" in self.output
67 - assert "test_skip (test_xunit_as_suite.TestForXunit) ... SKIP: skipit" in self.output
68 + if sys.version_info >= (3, 11):
69 + assert "test_skip (test_xunit_as_suite.TestForXunit.test_skip) ... SKIP: skipit" in self.output
70 + else:
71 + assert "test_skip (test_xunit_as_suite.TestForXunit) ... SKIP: skipit" in self.output
72 assert "XML: %s" % xml_results_filename in self.output
74 f = codecs.open(xml_results_filename,'r', encoding='utf8')
75 diff --git a/nose/config.py b/nose/config.py
76 index ad01e61..d9aec2d 100644
77 --- a/nose/config.py
78 +++ b/nose/config.py
79 @@ -78,7 +78,7 @@ class ConfiguredDefaultsOptionParser(object):
80 except AttributeError:
81 filename = '<???>'
82 try:
83 - cfg.readfp(fh)
84 + cfg.read_file(fh)
85 except ConfigParser.Error, exc:
86 raise ConfigError("Error reading config file %r: %s" %
87 (filename, str(exc)))
88 diff --git a/nose/plugins/errorclass.py b/nose/plugins/errorclass.py
89 index d1540e0..38ecec9 100644
90 --- a/nose/plugins/errorclass.py
91 +++ b/nose/plugins/errorclass.py
92 @@ -1,4 +1,15 @@
93 +import sys
95 +if sys.version_info >= (3, 11):
96 + method = "TestTodo.runTest"
97 + traceback = """
98 +...Todo("I need to test something")
99 +...
101 +else:
102 + method = "TestTodo"
103 + traceback = ""
104 +f"""
105 ErrorClass Plugins
106 ------------------
108 @@ -66,7 +77,7 @@ each step.
109 Now run the test. TODO is printed.
111 >>> _ = case(result) # doctest: +ELLIPSIS
112 - runTest (....TestTodo) ... TODO: I need to test something
113 + runTest (....{method}) ... TODO: I need to test something
115 Errors and failures are empty, but todo has our test:
117 @@ -79,10 +90,10 @@ Errors and failures are empty, but todo has our test:
118 >>> result.printErrors() # doctest: +ELLIPSIS
119 <BLANKLINE>
120 ======================================================================
121 - TODO: runTest (....TestTodo)
122 + TODO: runTest (....{method})
123 ----------------------------------------------------------------------
124 Traceback (most recent call last):
125 - ...
126 + ...{traceback}
127 ...Todo: I need to test something
128 <BLANKLINE>
130 diff --git a/nose/plugins/manager.py b/nose/plugins/manager.py
131 index 4d2ed22..daa9edb 100644
132 --- a/nose/plugins/manager.py
133 +++ b/nose/plugins/manager.py
134 @@ -105,7 +105,7 @@ class PluginProxy(object):
135 meth = getattr(plugin, call, None)
136 if meth is not None:
137 if call == 'loadTestsFromModule' and \
138 - len(inspect.getargspec(meth)[0]) == 2:
139 + len(inspect.getfullargspec(meth)[0]) == 2:
140 orig_meth = meth
141 meth = lambda module, path, **kwargs: orig_meth(module)
142 self.plugins.append((plugin, meth))
143 diff --git a/nose/result.py b/nose/result.py
144 index f974a14..228a42c 100644
145 --- a/nose/result.py
146 +++ b/nose/result.py
147 @@ -13,7 +13,7 @@ try:
148 # 2.7+
149 from unittest.runner import _TextTestResult
150 except ImportError:
151 - from unittest import _TextTestResult
152 + from unittest import TextTestResult as _TextTestResult
153 from nose.config import Config
154 from nose.util import isclass, ln as _ln # backwards compat
156 diff --git a/nose/util.py b/nose/util.py
157 index 80ab1d4..21770ae 100644
158 --- a/nose/util.py
159 +++ b/nose/util.py
160 @@ -449,15 +449,15 @@ def try_run(obj, names):
161 if type(obj) == types.ModuleType:
162 # py.test compatibility
163 if isinstance(func, types.FunctionType):
164 - args, varargs, varkw, defaults = \
165 - inspect.getargspec(func)
166 + args, varargs, varkw, defaults, *_ = \
167 + inspect.getfullargspec(func)
168 else:
169 # Not a function. If it's callable, call it anyway
170 if hasattr(func, '__call__') and not inspect.ismethod(func):
171 func = func.__call__
172 try:
173 - args, varargs, varkw, defaults = \
174 - inspect.getargspec(func)
175 + args, varargs, varkw, defaults, *_ = \
176 + inspect.getfullargspec(func)
177 args.pop(0) # pop the self off
178 except TypeError:
179 raise TypeError("Attribute %s of %r is not a python "
180 diff --git a/unit_tests/test_xunit.py b/unit_tests/test_xunit.py
181 index 2a9f69b..560b9c2 100644
182 --- a/unit_tests/test_xunit.py
183 +++ b/unit_tests/test_xunit.py
184 @@ -134,7 +134,8 @@ class TestXMLOutputWithXML(unittest.TestCase):
185 err_lines = err.text.strip().split("\n")
186 eq_(err_lines[0], 'Traceback (most recent call last):')
187 eq_(err_lines[-1], 'AssertionError: one is not \'equal\' to two')
188 - eq_(err_lines[-2], ' raise AssertionError("one is not \'equal\' to two")')
189 + r_line = -3 if '^' * 10 in err_lines[-2] else -2
190 + eq_(err_lines[r_line], ' raise AssertionError("one is not \'equal\' to two")')
191 else:
192 # this is a dumb test for 2.4-
193 assert '<?xml version="1.0" encoding="UTF-8"?>' in result
194 @@ -201,7 +202,8 @@ class TestXMLOutputWithXML(unittest.TestCase):
195 err_lines = err.text.strip().split("\n")
196 eq_(err_lines[0], 'Traceback (most recent call last):')
197 eq_(err_lines[-1], 'RuntimeError: some error happened')
198 - eq_(err_lines[-2], ' raise RuntimeError("some error happened")')
199 + r_line = -3 if '^' * 10 in err_lines[-2] else -2
200 + eq_(err_lines[r_line], ' raise RuntimeError("some error happened")')
201 else:
202 # this is a dumb test for 2.4-
203 assert '<?xml version="1.0" encoding="UTF-8"?>' in result