Enable support for pytest as our test runner.

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

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.

Summary ID
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.
196dfdde0c94ac9549a7606ff7e911245c6aa286
Description From Last Updated

Djblets -> Review Board

daviddavid

F401 'shutil' imported but unused

reviewbotreviewbot

F401 'shutil' imported but unused

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

david
  1. 
      
  2. conftest.py (Diff revision 1)
     
     
    Show all issues

    Djblets -> Review Board

  3. 
      
chipx86
Review request changed
Change Summary:
  • Removed an unused import.
  • Fixed a docstring to reference the right product.
Commits:
Summary ID
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
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.
a7148dc6197dc7023be724a13fdd98a8f4d6a5d8

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.0.x (c5a3dd4)