Enable support for pytest as our test runner.

Review Request #12024 — Created Jan. 31, 2022 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

This switches us to using pytest for running unit tests, along with a
couple of suitable plugins. pytest is maintained, as a wide ecosystem of
plugins, and offers us options for rethinking our testing infrastructure
down the road.

For the moment, we're still building unit tests around Python's
unittest library, Django's django.test, and Djblets's
djblets.testing. We'll probably continue to do this for the
foreseeable future, since there are benefits to the unittest-based
approach still, and switching everything over to pytest's view of
testing is a big project.

The configuration has a number of warnings that we disable. As we finish
the move to Django 3.2, we'll be able to remove many of these.

One important thing to note is that the ./reviewboard/manage.py test
command will still attempt to use the old test runner. Extensions use
that test runner as well, making that a tricky thing to cleanly switch
out.

So technically, we currently have two test runners we're using, but
pytest will be the official way to run the test suite for Review Board
going forward.

Ran pytest.

Unit tests are currently broken on release-5.0.x, but pytest at least
has the same errors (at least until I had to kill the suite).

This change was originally on release-4.0.x, where it passed the entire
suite.

Diff Revision 1

This is not the most recent revision of the diff. The latest diff is revision 3. See what's changed.

orig
1
2
3

Commits

First Last Summary ID Author
Enable support for pytest as our test runner.
This switches us to using pytest for running unit tests, along with a couple of suitable plugins. pytest is maintained, as a wide ecosystem of plugins, and offers us options for rethinking our testing infrastructure down the road. For the moment, we're still building unit tests around Python's `unittest` library, Django's `django.test`, and Djblets's `djblets.testing`. We'll probably continue to do this for the foreseeable future, since there are benefits to the `unittest`-based approach still, and switching everything over to pytest's view of testing is a big project. The configuration has a number of warnings that we disable. As we finish the move to Django 3.2, we'll be able to remove many of these. One important thing to note is that the `./reviewboard/manage.py test` command will still attempt to use the old test runner. Extensions use that test runner as well, making that a tricky thing to cleanly switch out. So technically, we currently have two test runners we're using, but pytest will be the official way to run the test suite for Review Board going forward.
41d620754591dbc2fcb8d68facde01b6bb253b1c Christian Hammond
conftest.py
dev-requirements.txt
setup.cfg
tests/runtests.py
Loading...