Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nosetests is not running for some reason

I'm going through the course of IBM for DevOps and Software Engineering and in one of the labs, I'm supposed to run some tests with the nosetests tool. This lab was designed to be done in a virtual environment, but I'd rather run it locally on my PC.

I cloned the git repo and installed nosetests with pip3 install nose. Then after I go to the root folder where the tests are located but with no success:

I tried to run it with the following methods:

  1. nosetests
  2. python3 nosetests
  3. /Library/Frameworks/Python.framework/Versions/3.11/bin/nosetests

but none of them work.

they give the following error messages:

  1. zsh: command not found: nosetests

  2. /Library/Frameworks/Python.framework/Versions/3.11/Resources/Python.app/Contents/MacOS/Python: can't open file '/Users/georgiangelov/devops-school/duwjx-tdd_bdd_PracticeCode/labs/01_running_tests_with_nose/nosetests': [Errno 2] No such file or directory

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/bin/nosetests", line 8, in <module>
    sys.exit(run_exit())
             ^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/nose/core.py", line 118, in __init__
    unittest.TestProgram.__init__(
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/unittest/main.py", line 101, in __init__
    self.parseArgs(argv)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/nose/core.py", line 179, in parseArgs
    self.createTests()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/nose/core.py", line 193, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/nose/loader.py", line 481, in loadTestsFromNames
    return unittest.TestLoader.loadTestsFromNames(self, names, module)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/unittest/loader.py", line 220, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/unittest/loader.py", line 220, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/nose/loader.py", line 454, in loadTestsFromName
    return LazySuite(
           ^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/nose/suite.py", line 53, in __init__
    super(LazySuite, self).__init__()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/unittest/suite.py", line 22, in __init__
    self._tests = []
    ^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/nose/suite.py", line 106, in _set_tests
    if isinstance(tests, collections.Callable) and not is_suite:
                         ^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'Callable'
like image 830
angelov_georgi Avatar asked Oct 30 '25 05:10

angelov_georgi


1 Answers

Turns out that nosetests is not supported for python 3.11. It's recommended to migrate to PyTest.

Nose is unmaintained and no longer works with Python 3.10 #1148

like image 103
angelov_georgi Avatar answered Nov 01 '25 19:11

angelov_georgi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!