|
|
|
diff --git a/nose/config.py b/nose/config.py
|
|
|
|
index ad01e61..d9aec2d 100644
|
|
|
|
--- a/nose/config.py
|
|
|
|
+++ b/nose/config.py
|
|
|
|
@@ -78,7 +78,7 @@ class ConfiguredDefaultsOptionParser(object):
|
|
|
|
except AttributeError:
|
|
|
|
filename = '<???>'
|
|
|
|
try:
|
|
|
|
- cfg.readfp(fh)
|
|
|
|
+ cfg.read_file(fh)
|
|
|
|
except ConfigParser.Error, exc:
|
|
|
|
raise ConfigError("Error reading config file %r: %s" %
|
|
|
|
(filename, str(exc)))
|
|
|
|
diff --git a/nose/result.py b/nose/result.py
|
|
|
|
index f974a14..228a42c 100644
|
|
|
|
--- a/nose/result.py
|
|
|
|
+++ b/nose/result.py
|
|
|
|
@@ -13,7 +13,7 @@ try:
|
|
|
|
# 2.7+
|
|
|
|
from unittest.runner import _TextTestResult
|
|
|
|
except ImportError:
|
|
|
|
- from unittest import _TextTestResult
|
|
|
|
+ from unittest import TextTestResult as _TextTestResult
|
|
|
|
from nose.config import Config
|
|
|
|
from nose.util import isclass, ln as _ln # backwards compat
|
|
|
|
|
|
|
|
diff --git a/unit_tests/test_xunit.py b/unit_tests/test_xunit.py
|
|
|
|
index 2a9f69b..560b9c2 100644
|
|
|
|
--- a/unit_tests/test_xunit.py
|
|
|
|
+++ b/unit_tests/test_xunit.py
|
|
|
|
@@ -134,7 +134,8 @@ class TestXMLOutputWithXML(unittest.TestCase):
|
|
|
|
err_lines = err.text.strip().split("\n")
|
|
|
|
eq_(err_lines[0], 'Traceback (most recent call last):')
|
|
|
|
eq_(err_lines[-1], 'AssertionError: one is not \'equal\' to two')
|
|
|
|
- eq_(err_lines[-2], ' raise AssertionError("one is not \'equal\' to two")')
|
|
|
|
+ r_line = -3 if '^' * 10 in err_lines[-2] else -2
|
|
|
|
+ eq_(err_lines[r_line], ' raise AssertionError("one is not \'equal\' to two")')
|
|
|
|
else:
|
|
|
|
# this is a dumb test for 2.4-
|
|
|
|
assert '<?xml version="1.0" encoding="UTF-8"?>' in result
|
|
|
|
@@ -201,7 +202,8 @@ class TestXMLOutputWithXML(unittest.TestCase):
|
|
|
|
err_lines = err.text.strip().split("\n")
|
|
|
|
eq_(err_lines[0], 'Traceback (most recent call last):')
|
|
|
|
eq_(err_lines[-1], 'RuntimeError: some error happened')
|
|
|
|
- eq_(err_lines[-2], ' raise RuntimeError("some error happened")')
|
|
|
|
+ r_line = -3 if '^' * 10 in err_lines[-2] else -2
|
|
|
|
+ eq_(err_lines[r_line], ' raise RuntimeError("some error happened")')
|
|
|
|
else:
|
|
|
|
# this is a dumb test for 2.4-
|
|
|
|
assert '<?xml version="1.0" encoding="UTF-8"?>' in result
|
Python 3.11.0a2 fixes
The error was:
+ /usr/bin/python3 selftest.py
Traceback (most recent call last):
File "/builddir/build/BUILD/nose-1.3.7/build/tests/nose/plugins/manager.py", line 250, in __getattr__
return self._proxies[call]
~~~~~~~~~~~~~^^^^^^
KeyError: 'loadTestsFromModule'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/builddir/build/BUILD/nose-1.3.7/selftest.py", line 60, in <module>
nose.run_exit()
^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/nose-1.3.7/build/tests/nose/core.py", line 118, in __init__
unittest.TestProgram.__init__(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/unittest/main.py", line 101, in __init__
self.runTests()
^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/nose-1.3.7/build/tests/nose/core.py", line 207, in runTests
result = self.testRunner.run(self.test)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/nose-1.3.7/build/tests/nose/core.py", line 62, in run
test(result)
^^^^^^^^^^^^
File "/builddir/build/BUILD/nose-1.3.7/build/tests/nose/suite.py", line 177, in __call__
return self.run(*arg, **kw)
^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/nose-1.3.7/build/tests/nose/suite.py", line 224, in run
test(orig)
^^^^^^^^^^
File "/usr/lib64/python3.11/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/nose-1.3.7/build/tests/nose/suite.py", line 72, in run
for test in self._tests:
^^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/nose-1.3.7/build/tests/nose/suite.py", line 99, in _get_tests
for test in self.test_generator:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/nose-1.3.7/build/tests/nose/loader.py", line 190, in loadTestsFromDir
yield self.loadTestsFromName(
^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/nose-1.3.7/build/tests/nose/loader.py", line 430, in loadTestsFromName
return self.loadTestsFromModule(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/nose-1.3.7/build/tests/nose/loader.py", line 353, in loadTestsFromModule
tests.extend(self.loadTestsFromDir(module_path))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/nose-1.3.7/build/tests/nose/loader.py", line 182, in loadTestsFromDir
yield self.loadTestsFromName(
^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/nose-1.3.7/build/tests/nose/loader.py", line 430, in loadTestsFromName
return self.loadTestsFromModule(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/nose-1.3.7/build/tests/nose/loader.py", line 355, in loadTestsFromModule
for test in self.config.plugins.loadTestsFromModule(module, path):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/nose-1.3.7/build/tests/nose/plugins/manager.py", line 252, in __getattr__
proxy = self.proxyClass(call, self._plugins)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/nose-1.3.7/build/tests/nose/plugins/manager.py", line 96, in __init__
self.addPlugin(p, call)
^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/nose-1.3.7/build/tests/nose/plugins/manager.py", line 108, in addPlugin
len(inspect.getargspec(meth)[0]) == 2:
^^^^^^^^^^^^^^^^^^
AttributeError: module 'inspect' has no attribute 'getargspec'
3 years ago
|
|
|
diff --git a/nose/plugins/manager.py b/nose/plugins/manager.py
|
|
|
|
index 4d2ed22..daa9edb 100644
|
|
|
|
--- a/nose/plugins/manager.py
|
|
|
|
+++ b/nose/plugins/manager.py
|
|
|
|
@@ -105,7 +105,7 @@ class PluginProxy(object):
|
|
|
|
meth = getattr(plugin, call, None)
|
|
|
|
if meth is not None:
|
|
|
|
if call == 'loadTestsFromModule' and \
|
|
|
|
- len(inspect.getargspec(meth)[0]) == 2:
|
|
|
|
+ len(inspect.getfullargspec(meth)[0]) == 2:
|
|
|
|
orig_meth = meth
|
|
|
|
meth = lambda module, path, **kwargs: orig_meth(module)
|
|
|
|
self.plugins.append((plugin, meth))
|
|
|
|
diff --git a/nose/util.py b/nose/util.py
|
|
|
|
index 80ab1d4..21770ae 100644
|
|
|
|
--- a/nose/util.py
|
|
|
|
+++ b/nose/util.py
|
|
|
|
@@ -449,15 +449,15 @@ def try_run(obj, names):
|
|
|
|
if type(obj) == types.ModuleType:
|
|
|
|
# py.test compatibility
|
|
|
|
if isinstance(func, types.FunctionType):
|
|
|
|
- args, varargs, varkw, defaults = \
|
|
|
|
- inspect.getargspec(func)
|
|
|
|
+ args, varargs, varkw, defaults, *_ = \
|
|
|
|
+ inspect.getfullargspec(func)
|
|
|
|
else:
|
|
|
|
# Not a function. If it's callable, call it anyway
|
|
|
|
if hasattr(func, '__call__') and not inspect.ismethod(func):
|
|
|
|
func = func.__call__
|
|
|
|
try:
|
|
|
|
- args, varargs, varkw, defaults = \
|
|
|
|
- inspect.getargspec(func)
|
|
|
|
+ args, varargs, varkw, defaults, *_ = \
|
|
|
|
+ inspect.getfullargspec(func)
|
|
|
|
args.pop(0) # pop the self off
|
|
|
|
except TypeError:
|
|
|
|
raise TypeError("Attribute %s of %r is not a python "
|