seomoz / shovel

Rake, for Python
MIT License
660 stars 49 forks source link

Convert shovel to use nose2 for testing #50

Closed siris closed 2 years ago

siris commented 2 years ago

Summary

Deprecate the use of nose in favor of nose2 for all testing

This ensure shovel testing is compatible with Python 3.10.x and greater as nose is currently not compatible with Python 3.10.x. If you run python setup.py nosetests on Python 3.10.x you will get this error:

python setup.py nosetests
running nosetests
running egg_info
writing shovel.egg-info/PKG-INFO
writing dependency_links to shovel.egg-info/dependency_links.txt
writing entry points to shovel.egg-info/entry_points.txt
writing top-level names to shovel.egg-info/top_level.txt
reading manifest file 'shovel.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'shovel.egg-info/SOURCES.txt'
Traceback (most recent call last):
  File "/home/ss/repos/shovel/setup.py", line 7, in <module>
    setup(
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.10/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/ss/.local/lib/python3.10/site-packages/nose/commands.py", line 158, in run
    TestProgram(argv=argv, config=self.__config)
  File "/home/ss/.local/lib/python3.10/site-packages/nose/core.py", line 118, in __init__
    unittest.TestProgram.__init__(
  File "/usr/lib/python3.10/unittest/main.py", line 100, in __init__
    self.parseArgs(argv)
  File "/home/ss/.local/lib/python3.10/site-packages/nose/core.py", line 179, in parseArgs
    self.createTests()
  File "/home/ss/.local/lib/python3.10/site-packages/nose/core.py", line 193, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames)
  File "/home/ss/.local/lib/python3.10/site-packages/nose/loader.py", line 481, in loadTestsFromNames
    return unittest.TestLoader.loadTestsFromNames(self, names, module)
  File "/usr/lib/python3.10/unittest/loader.py", line 220, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib/python3.10/unittest/loader.py", line 220, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/home/ss/.local/lib/python3.10/site-packages/nose/loader.py", line 454, in loadTestsFromName
    return LazySuite(
  File "/home/ss/.local/lib/python3.10/site-packages/nose/suite.py", line 53, in __init__
    super(LazySuite, self).__init__()
  File "/usr/lib/python3.10/unittest/suite.py", line 22, in __init__
    self._tests = []
  File "/home/ss/.local/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'

That is because this deprecation in collections in Python 3.10