Switch Djblets's test suite to use pytest.
Review Request #11919 — Created Jan. 10, 2022 and updated
Historically, we've used
noseas the test runner, with a custom test
runner script responsible for setting up a test run.
nose1.x hasn't been updated in a long while, and isn't
compatible with modern versions of Python 3. The forks also don't
support Python 3 very well.
nose2does, but is so different that it's
not a great option for us.
Instead, we're moving to
pytest. This is a much more modern test
runner with a lot of interesting capabilities and a wide ecosystem of
We now use this and define what little test setup we still need in
conftest.py, which is where we can define hooks for
We also use the
pytest-djangomodule, which is an official
plugin for setting up a Django environment.
Developers can now run
pytestdirectly to run the test suite. The old
./tests/runtests.pystill works, but is deprecated, and merely wraps
Note that we still have a test runner we ship with Django that uses
nose. For now, this will continue to use
nose, but we won't be using
it. We will need to evaluate a modernization or deprecation plan for
Unit tests pass for all supported versions of Python.
F401 'djblets.util.compat.python.collections' imported but unused