Closed cclauss closed 2 years ago
Thanks.
It's in my todo list to change to pytest, however I had to find the time to reconfigure my local dev env first! This applies to isbntools
too.
Anyway, the library can be used with python 3.10!
Fixed in
STATUS: RESOLVED
SOLUTION: Installing 'nose2' instead of the 'nosetests'
I am still having this issue; nosetest runs fine for 3.7, 3.8, and 3.9 but fails for 3.10.
Repo: https://github.com/Pranavkhade/PACKMAN
Command: nosetest packman
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.10.10/x64/bin/nosetests", line [8](https://github.com/Pranavkhade/PACKMAN/actions/runs/4538327140/jobs/7997128803#step:5:9), in <module>
sys.exit(run_exit())
File "/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/site-packages/nose/core.py", line 118, in __init__
unittest.TestProgram.__init__(
File "/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/unittest/main.py", line 100, in __init__
self.parseArgs(argv)
File "/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/site-packages/nose/core.py", line 17[9](https://github.com/Pranavkhade/PACKMAN/actions/runs/4538327140/jobs/7997128803#step:5:10), in parseArgs
self.createTests()
File "/opt/hostedtoolcache/Python/3.[10](https://github.com/Pranavkhade/PACKMAN/actions/runs/4538327140/jobs/7997128803#step:5:11).10/x64/lib/python3.10/site-packages/nose/core.py", line 193, in createTests
self.test = self.testLoader.loadTestsFromNames(self.testNames)
File "/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/site-packages/nose/loader.py", line 481, in loadTestsFromNames
return unittest.TestLoader.loadTestsFromNames(self, names, module)
File "/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/unittest/loader.py", line 220, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/unittest/loader.py", line 220, in <listcomp>
suites = [self.loadTestsFromName(name, module) for name in names]
File "/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/site-packages/nose/loader.py", line 431, in loadTestsFromName
return self.loadTestsFromModule(
File "/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/site-packages/nose/loader.py", line 329, in loadTestsFromModule
elif isfunction(test) and self.selector.wantFunction(test):
File "/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/site-packages/nose/selector.py", line [14](https://github.com/Pranavkhade/PACKMAN/actions/runs/4538327140/jobs/7997128803#step:5:15)9, in wantFunction
plug_wants = self.plugins.wantFunction(function)
File "/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/site-packages/nose/plugins/manager.py", line 99, in __call__
return self.call(*arg, **kw)
File "/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/site-packages/nose/plugins/manager.py", line [16](https://github.com/Pranavkhade/PACKMAN/actions/runs/4538327140/jobs/7997128803#step:5:17)7, in simple
result = meth(*arg, **kw)
File "/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/site-packages/nose/plugins/attrib.py", line 278, in wantFunction
return self.validateAttrib(function)
File "/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/site-packages/nose/plugins/attrib.py", line [24](https://github.com/Pranavkhade/PACKMAN/actions/runs/4538327140/jobs/7997128803#step:5:25)2, in validateAttrib
if isinstance(value, collections.Callable):
AttributeError: module 'collections' has no attribute 'Callable'
Error: Process completed with exit code 1.
We ran https://pypi.org/project/nose2pytest in pull request #108 so now this repo tests with pytest, not nose.
To run nose in python is this the proble is that module colleciton doesnt have the attribute Callable You should change the lines of code 541 and 458 in the suite.py file. The correct line to run nose is this you should change it also on the line 30 of the case.py file if isinstance(tests, collections.abc.Callable) or isinstance(tests, unittest.TestSuite): instead of if isinstance(tests, collections.Callable) or isinstance(tests, unittest.TestSuite):
File "C:\Users\USUARIO\AppData\Local\Programs\Python\Python311\Lib\site-packages\nose\core.py", line 62, in run test(result) File "C:\Users\USUARIO\AppData\Local\Programs\Python\Python311\Lib\site-packages\nose\suite.py", line 178, in call return self.run(*arg, *kw) ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\USUARIO\AppData\Local\Programs\Python\Python311\Lib\site-packages\nose\suite.py", line 225, in run test(orig) File "C:\Users\USUARIO\AppData\Local\Programs\Python\Python311\Lib\site-packages\nose\suite.py", line 178, in call return self.run(arg, **kw) ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\USUARIO\AppData\Local\Programs\Python\Python311\Lib\site-packages\nose\suite.py", line 218, in run for test in self._tests: File "C:\Users\USUARIO\AppData\Local\Programs\Python\Python311\Lib\site-packages\nose\suite.py", line 377, in _get_wrapped_tests yield Test(test, ^^^^^^^^^^ File "C:\Users\USUARIO\AppData\Local\Programs\Python\Python311\Lib\site-packages\nose\case.py", line 30, in init if not isinstance(test, collections.Callable): ^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'collections' has no attribute 'Callable'
nose is nolonger supported by py3. You need to reinstall pynose as an alter.
I uninstalled nose, and installed pynose. Then nosetests
runs perfectly.
pip install pynose
nosetests
result:
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
python version -- 3.10 runs in virtual env.
Ran 0 tests in 0.000s
Running zero tests is probably not testing anything.
https://github.com/pytest-dev/nose2pytest
nose.tools.assert_equals()
will raise an AttributeError on Python >= 3.1093 used https://pypi.org/project/nose2pytest to migrate to pytest.
https://pypi.org/project/nose was last updated in 2015.