NASA-AMMOS / AIT-DSN

MIT License
19 stars 10 forks source link

Issue #199 - Upgrade to Python 3.10 #201

Open christianmkuss opened 1 year ago

christianmkuss commented 1 year ago

Because of the strictly pinned versions this library would only work with Python 3.7, as stated in the documentation. Since the dependencies are well founded they provide support for newer versions of Python, including Python 3.10. By migrating to the newer versions this library will now support Python3.10 but drop support for other versions.

Fixes #199

nttoole commented 1 year ago

@christianmkuss When running the tests, I am seeing an error related to collections.Callable Do you experience this on your end? Or perhaps you are including a new version of a dependency?

(venv) nttoole@MT-202661 AIT-DSN % python setup.py nosetests
...Traceback (most recent call last):
  File "/Users/nttoole/Development/ait/git_repos/py3.10_112822/AIT-DSN/setup.py", line 27, in <module>
    setup(
  File "/Users/nttoole/Development/ait/git_repos/py3.10_112822/venv/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
    return distutils.core.setup(**attrs)
  File "/Users/nttoole/Development/ait/git_repos/py3.10_112822/venv/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
  File "/Users/nttoole/Development/ait/git_repos/py3.10_112822/venv/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/Users/nttoole/Development/ait/git_repos/py3.10_112822/venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 973, in run_commands
    self.run_command(cmd)
  File "/Users/nttoole/Development/ait/git_repos/py3.10_112822/venv/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
    super().run_command(command)
  File "/Users/nttoole/Development/ait/git_repos/py3.10_112822/venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
    cmd_obj.run()
  File "/Users/nttoole/Development/ait/git_repos/py3.10_112822/venv/lib/python3.10/site-packages/nose/commands.py", line 158, in run
    TestProgram(argv=argv, config=self.__config)
  File "/Users/nttoole/Development/ait/git_repos/py3.10_112822/venv/lib/python3.10/site-packages/nose/core.py", line 118, in __init__
    unittest.TestProgram.__init__(
  File "/Users/nttoole/.pyenv/versions/3.10.5/lib/python3.10/unittest/main.py", line 100, in __init__
    self.parseArgs(argv)
  File "/Users/nttoole/Development/ait/git_repos/py3.10_112822/venv/lib/python3.10/site-packages/nose/core.py", line 179, in parseArgs
    self.createTests()
  File "/Users/nttoole/Development/ait/git_repos/py3.10_112822/venv/lib/python3.10/site-packages/nose/core.py", line 193, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames)
  File "/Users/nttoole/Development/ait/git_repos/py3.10_112822/venv/lib/python3.10/site-packages/nose/loader.py", line 481, in loadTestsFromNames
    return unittest.TestLoader.loadTestsFromNames(self, names, module)
  File "/Users/nttoole/.pyenv/versions/3.10.5/lib/python3.10/unittest/loader.py", line 220, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/Users/nttoole/.pyenv/versions/3.10.5/lib/python3.10/unittest/loader.py", line 220, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/Users/nttoole/Development/ait/git_repos/py3.10_112822/venv/lib/python3.10/site-packages/nose/loader.py", line 454, in loadTestsFromName
    return LazySuite(
  File "/Users/nttoole/Development/ait/git_repos/py3.10_112822/venv/lib/python3.10/site-packages/nose/suite.py", line 53, in __init__
    super(LazySuite, self).__init__()
  File "/Users/nttoole/.pyenv/versions/3.10.5/lib/python3.10/unittest/suite.py", line 22, in __init__
    self._tests = []
  File "/Users/nttoole/Development/ait/git_repos/py3.10_112822/venv/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'
christianmkuss commented 1 year ago

Hmm, looks like nose is no longer maintained and doesn't support Python 3.9+ (https://github.com/nose-devs/nose/issues/1099). I was able to run the tests with pytest --ignore ait/dsn/bin/examples and can completely remove nose as a dependency by changing

with nose.tools.assert_raises(ImportError):

in ait/dsn/encrypt/test/test_encrypt.py to

with pytest.raises(ImportError):

If you want to fully transition to pytest and drop nose I can add that to this PR. Otherwise I don't think there is a way to run the tests with 3.10.

nttoole commented 1 year ago

@christianmkuss I believe our plan is to fully transition to pytest (as part of transitioning the GUI and DSN to poetry builds). So yes, if you wouldn't mind including those changes with the PR, we would appreciate it. Thanks