Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove Nose dependency #1647

Open
albertz opened this issue Nov 14, 2024 · 0 comments
Open

remove Nose dependency #1647

albertz opened this issue Nov 14, 2024 · 0 comments
Assignees

Comments

@albertz
Copy link
Member

albertz commented Nov 14, 2024

We used to use nose for our tests. We now switched to pytest. However, in some of the tests, we still make use of some nose utility functions like:

from nose.tools import assert_equal, assert_not_equal, assert_raises, assert_true, assert_is

I think pytest does not provide similar functions (or does it?). However, it should be trivial to implement our own variants for these, or just rewrite all code usages by directly using assert.

(Pytest cleverly handles normal assert and somehow figures out for sth like assert a == b that this is checking equality, and then also prints a and b. I'm not sure if those heuristics/tricks/hacks always work correctly, although they seem to. But maybe to have that explicit as assert_equal is better also when we want to switch at some later point to some other testing framework? Not sure...)

Nose is deprecated and I think only works with Python <=3.9, not later. So we definitely must remove this dependency for our tests.

The error you see when you run this on a newer Python version:

test_Util.py:4: in <module>
    from nose.tools import assert_equal, assert_not_equal, assert_raises, assert_true, assert_is
/work/az668407/py-envs/py3.12-torch2.5/lib64/python3.12/site-packages/nose/__init__.py:1: in <module>
    from nose.core import collector, main, run, run_exit, runmodule
/work/az668407/py-envs/py3.12-torch2.5/lib64/python3.12/site-packages/nose/core.py:12: in <module>
    from nose.loader import defaultTestLoader
/work/az668407/py-envs/py3.12-torch2.5/lib64/python3.12/site-packages/nose/loader.py:21: in <module>
    from nose.importer import Importer, add_path, remove_path
/work/az668407/py-envs/py3.12-torch2.5/lib64/python3.12/site-packages/nose/importer.py:12: in <module>
    from imp import find_module, load_module, acquire_lock, release_lock
E   ModuleNotFoundError: No module named 'imp'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants