Testing the code in this repository is taken very seriously. We want to facilitate confidence that any change will have the intended side-effects and won’t regress behavior. We do this by providing a testing framework that is comprehensive and robust.
We currently support the following flavors of tests:
- Python unit tests
- Mercurial t tests
- Mercurial .py tests
The test driver is responsible for identifying which flavor a particular file is.
Many tests interact with services running locally, commonly inside Docker containers. For example, MozReview tests create Bugzilla, Pulse, and Mercurial servers. Running actual services is encouraged over mocking.
Tests are executed by running the following in a built environment:
To see help on options that control execution:
$ ./run-tests --help
Unknown script arguments will be proxied to Mercurial’s
Common tasks are described below.
Run all tests, 4 at a time:
$ ./run-tests -j4
Obtain code coverage results (makes tests run slower):
$ ./run-tests --cover
Use Docker images from last run (makes tests run faster):
$ ./run-tests --use-last-images
Test a single file:
$ ./run-tests path/to/test.t
Run all tests in a directory:
$ ./run-tests hgext/reviewboard
Run a test in debug mode (see progress, interact with a debugger):
$ ./run-tests -d path/to/test.t
Run tests against all supported Mercurial versions:
$ ./run-tests --all-versions
Run tests with a specific Mercurial installation:
$ ./run-tests --with-hg=/path/to/hg
Do not run Selenium tests:
$ ./run-tests --headless
Do not run tests that require Docker:
$ ./run-tests --no-docker