Enable support for pytest as our test runner.

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

chipx86
Review Board
release-5.0.x
reviewboard

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
Enable support for pytest as our test runner.
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)
     
     

    Djblets -> Review Board

  3. 
      
chipx86
Review request changed

Change Summary:

  • Removed an unused import.
  • Fixed a docstring to reference the right product.

Commits:

Summary
-
Enable support for pytest as our test runner.
+
Enable support for pytest as our test runner.

Diff:

Revision 2 (+414 -56)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-5.0.x (c5a3dd4)
Loading...