Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collections.Callable has become collections.abc.Callable in python 3.10 + #1127

Open
akshaydse opened this issue Sep 8, 2023 · 2 comments
Open

Comments

@akshaydse
Copy link

collections.Callable that has been used in _set_tests has become collections.abc.Callable is simple change can run it higher versions of python
As one instance you can find it
in _set_tests
if isinstance(tests, collections.Callable) and not is_suite:

@akshaydse
Copy link
Author

It is easily solvable by just adding two lines in nosetest bash file

Import collections.abc
collections.Callable= collections.abc.Callable

cbodley added a commit to cbodley/teuthology that referenced this issue May 23, 2024
after upgrading teuthology to centos 9 and python 3.10, the rgw
multisite test suite now fails to invoke nosetests with:

> AttributeError: module 'collections' has no attribute 'Callable'

this is a known issue tracked in nose-devs/nose#1127

Shilpa found a new 'pynose' package which claims that:

> This version of nose is compatible with Python 3.7+ (including 3.13+).

replace the nose dependency that i initially added in
ceph#1069 with the current version
1.5.1 of pynose

to prepare this pr, i first changed setup.cfg then ran:

> ./update-requirements.sh -P "pynose==1.5.1"

Signed-off-by: Casey Bodley <[email protected]>
cbodley added a commit to cbodley/teuthology that referenced this issue May 23, 2024
after upgrading teuthology to centos 9 and python 3.10, the rgw
multisite test suite now fails to invoke nosetests with:

> AttributeError: module 'collections' has no attribute 'Callable'

this is a known issue tracked in nose-devs/nose#1127

Shilpa found a new 'pynose' package which claims that:

> This version of nose is compatible with Python 3.7+ (including 3.13+).

replace the nose dependency that i initially added in
ceph#1069 with the current version
1.5.1 of pynose

to prepare this pr, i first changed setup.cfg then ran:

> ./update-requirements.sh -P "pynose==1.5.1"

Fixes: https://tracker.ceph.com/issues/66183

Signed-off-by: Casey Bodley <[email protected]>
@douglasdcm
Copy link

I'm having the same issue in Python 3.11

python version

(venv311) douglas@douglas:~/repo/guara$ python -V
Python 3.11.9

execution

(venv311) douglas@douglas:~/repo/guara$ nosetests test_todo_nosetests.py
Traceback (most recent call last):
  File "/home/douglas/repo/guara/venv311/lib/python3.11/site-packages/nose/loader.py", line 417, in loadTestsFromName
    module = self.importer.importFromPath(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/douglas/repo/guara/venv311/lib/python3.11/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/douglas/repo/guara/venv311/lib/python3.11/site-packages/nose/importer.py", line 79, in importFromDir
    fh, filename, desc = find_module(part, path)
                         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/imp.py", line 297, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named 'test_todo_nosetests'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/douglas/repo/guara/venv311/bin/nosetests", line 8, in <module>
    sys.exit(run_exit())
             ^^^^^^^^^^
  File "/home/douglas/repo/guara/venv311/lib/python3.11/site-packages/nose/core.py", line 118, in __init__
    unittest.TestProgram.__init__(
  File "/usr/local/lib/python3.11/unittest/main.py", line 101, in __init__
    self.parseArgs(argv)
  File "/home/douglas/repo/guara/venv311/lib/python3.11/site-packages/nose/core.py", line 179, in parseArgs
    self.createTests()
  File "/home/douglas/repo/guara/venv311/lib/python3.11/site-packages/nose/core.py", line 193, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/douglas/repo/guara/venv311/lib/python3.11/site-packages/nose/loader.py", line 481, in loadTestsFromNames
    return unittest.TestLoader.loadTestsFromNames(self, names, module)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/unittest/loader.py", line 232, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/unittest/loader.py", line 232, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/douglas/repo/guara/venv311/lib/python3.11/site-packages/nose/loader.py", line 426, in loadTestsFromName
    return suite([Failure(exc[0], exc[1], exc[2],
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/douglas/repo/guara/venv311/lib/python3.11/site-packages/nose/suite.py", line 423, in __call__
    tests = self.wrapTests(tests)
            ^^^^^^^^^^^^^^^^^^^^^
  File "/home/douglas/repo/guara/venv311/lib/python3.11/site-packages/nose/suite.py", line 541, in wrapTests
    if isinstance(tests, collections.Callable) or isinstance(tests, unittest.TestSuite):
                         ^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'Callable'
(venv311) douglas@douglas:~/repo/guara$ python -V
Python 3.11.9

pip freeze

~/repo/guara$ pip freeze
nose==1.3.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants