Issue with Ex 46 - can't run nosetests

To the best of my knowledge, i’ve setup everything as per the instructions. I’m trying to get this right and to check if there’s anything i’ve missed out. For context, the version of python i’m using is 3.10.8 - although i’m not sure if this should be causing problems

This is what’s showing when call ls - R from the skeleton , the files seem to line up with the book except for some reason setup.py doesn’t show in the drop down list

Here’s the code from setup.py:
—begin—(not included in code)
try:
from setuptools import setup
except ImportError:
from distutils.core import setup

config = {
‘description’ : ‘My Project’,
‘author’: ‘My Name’,
‘url’: ‘URL to get it at.’,
‘download_url’: “Where to download it”,
‘author_email’: ‘My email.’,
‘version’: ‘0.1’,
‘install_requires’: [‘nose’],
‘packages’: [‘NAME’],
‘scripts’: [],
‘name’: ‘projectname’
}

setup(**config)
—end—(not included in code)

and this is NAME.py

—begin—(not included in code)
from nose.tools import *
import NAME

def setup():
print(“SETUP!”)

def teardown():
print(“TEAR DOWN!”)

def test_basic():
print(“I RAN!”, end=’ ')
—end—(not included in code)

when calling nosetests from the skeleton directory, the error message I get is as below

Traceback (most recent call last):
File “/Users/wenmingsoh/.venvs/lpthw/bin/nosetests”, line 8, in
sys.exit(run_exit())
File “/Users/wenmingsoh/.venvs/lpthw/lib/python3.10/site-packages/nose/core.py”, line 118, in init
unittest.TestProgram.init(
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/unittest/main.py”, line 100, in init
self.parseArgs(argv)
File “/Users/wenmingsoh/.venvs/lpthw/lib/python3.10/site-packages/nose/core.py”, line 179, in parseArgs
self.createTests()
File “/Users/wenmingsoh/.venvs/lpthw/lib/python3.10/site-packages/nose/core.py”, line 193, in createTests
self.test = self.testLoader.loadTestsFromNames(self.testNames)
File “/Users/wenmingsoh/.venvs/lpthw/lib/python3.10/site-packages/nose/loader.py”, line 481, in loadTestsFromNames
return unittest.TestLoader.loadTestsFromNames(self, names, module)
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/unittest/loader.py”, line 220, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/unittest/loader.py”, line 220, in
suites = [self.loadTestsFromName(name, module) for name in names]
File “/Users/wenmingsoh/.venvs/lpthw/lib/python3.10/site-packages/nose/loader.py”, line 454, in loadTestsFromName
return LazySuite(
File “/Users/wenmingsoh/.venvs/lpthw/lib/python3.10/site-packages/nose/suite.py”, line 53, in init
super(LazySuite, self).init()
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/unittest/suite.py”, line 22, in init
self._tests = []
File “/Users/wenmingsoh/.venvs/lpthw/lib/python3.10/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’

I really don’t know how to get this right from here but I would really like to try if I can get help. Thanks in advance

Hi - try searching this site for Nosetest. There are a few threads about not using it as it pretty much unmaintained. Preference is now Pytest.