google / cloud-forensics-utils

Python library to carry out DFIR analysis on the Cloud
Apache License 2.0
452 stars 89 forks source link

Support for Python 3.10 tests #472

Closed jleaniz closed 1 year ago

jleaniz commented 1 year ago

Nose library for unit tests is deprecated and does not support Python 3.10.

Run nosetests -vv --with-coverage --cover-package=libcloudforensics
nose.config: INFO: Ignoring files matching ['^\\.', '^_', '^setup\\.py$']
nose.plugins.cover: INFO: Coverage report will include only packages: ['libcloudforensics']
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.11/x[6](https://github.com/jleaniz/cloud-forensics-utils/actions/runs/4928021894/jobs/8805836995#step:5:7)4/bin/nosetests", line 8, in <module>
    sys.exit(run_exit())
  File "/opt/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/site-packages/nose/core.py", line 118, in __init__
    unittest.TestProgram.__init__(
  File "/opt/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/unittest/main.py", line 100, in __init__
    self.parseArgs(argv)
  File "/opt/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/site-packages/nose/core.py", line 1[7](https://github.com/jleaniz/cloud-forensics-utils/actions/runs/4928021894/jobs/8805836995#step:5:8)9, in parseArgs
    self.createTests()
  File "/opt/hostedtoolcache/Python/3.10.11/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.11/x64/lib/python3.10/site-packages/nose/loader.py", line 4[8](https://github.com/jleaniz/cloud-forensics-utils/actions/runs/4928021894/jobs/8805836995#step:5:9)1, in loadTestsFromNames
    return unittest.TestLoader.loadTestsFromNames(self, names, module)
  File "/opt/hostedtoolcache/Python/3.[10](https://github.com/jleaniz/cloud-forensics-utils/actions/runs/4928021894/jobs/8805836995#step:5:11).[11](https://github.com/jleaniz/cloud-forensics-utils/actions/runs/4928021894/jobs/8805836995#step:5:12)/x64/lib/python3.10/unittest/loader.py", line 2[20](https://github.com/jleaniz/cloud-forensics-utils/actions/runs/4928021894/jobs/8805836995#step:5:21), in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/opt/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/unittest/loader.py", line [22](https://github.com/jleaniz/cloud-forensics-utils/actions/runs/4928021894/jobs/8805836995#step:5:23)0, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/opt/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/site-packages/nose/loader.py", line 454, in loadTestsFromName
    return LazySuite(
  File "/opt/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/site-packages/nose/suite.py", line 53, in __init__
    super(LazySuite, self).__init__()
  File "/opt/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/unittest/suite.py", line 22, in __init__
    self._tests = []
  File "/opt/hostedtoolcache/Python/3.10.11/x64/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'
Error: Process completed with exit code 1.

nose usage should be removed in favor of unittest or pytest -- which would allow running the tests in Python 3.10