diff options
author | Mike Frysinger <vapier@google.com> | 2019-12-01 22:47:21 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2019-12-02 04:24:23 +0000 |
commit | 4997d1c83870c00ec7934ce55570e1d3fbade66f (patch) | |
tree | ea27fd62abe6c815a9d75d6874c6d85b5d2f6e13 /SUBMITTING_PATCHES.md | |
parent | 5b3a57c3ffdabe421817dbb63ee243b2c9cd0797 (diff) | |
download | git-repo-4997d1c83870c00ec7934ce55570e1d3fbade66f.tar.gz |
tox: add & document tox usage
This makes it easy to run all the tests against multiple versions
of Python. We want to make sure Python 2.7 & 3.6+ work.
Change-Id: Ia7b16eb46a2aa7c240f03bb291987fa8cb215267
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/247174
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'SUBMITTING_PATCHES.md')
-rw-r--r-- | SUBMITTING_PATCHES.md | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/SUBMITTING_PATCHES.md b/SUBMITTING_PATCHES.md index e8a72e87..5021e7ee 100644 --- a/SUBMITTING_PATCHES.md +++ b/SUBMITTING_PATCHES.md | |||
@@ -69,10 +69,38 @@ suppressed in the included `.flake8` file. | |||
69 | 69 | ||
70 | ## Running tests | 70 | ## Running tests |
71 | 71 | ||
72 | There is a [`./run_tests`](./run_tests) helper script for quickly invoking all | 72 | We use [pytest](https://pytest.org/) and [tox](https://tox.readthedocs.io/) for |
73 | of our unittests. The coverage isn't great currently, but it should still be | 73 | running tests. You should make sure to install those first. |
74 | run for all commits. | ||
75 | 74 | ||
75 | To run the full suite against all supported Python versions, simply execute: | ||
76 | ```sh | ||
77 | $ tox -p auto | ||
78 | ``` | ||
79 | |||
80 | We have [`./run_tests`](./run_tests) which is a simple wrapper around `pytest`: | ||
81 | ```sh | ||
82 | # Run the full suite against the default Python version. | ||
83 | $ ./run_tests | ||
84 | # List each test as it runs. | ||
85 | $ ./run_tests -v | ||
86 | |||
87 | # Run a specific unittest module (and all tests in it). | ||
88 | $ ./run_tests tests/test_git_command.py | ||
89 | |||
90 | # Run a specific testsuite in a specific unittest module. | ||
91 | $ ./run_tests tests/test_editor.py::EditString | ||
92 | |||
93 | # Run a single test. | ||
94 | $ ./run_tests tests/test_editor.py::EditString::test_cat_editor | ||
95 | |||
96 | # List all available tests. | ||
97 | $ ./run_tests --collect-only | ||
98 | |||
99 | # Run a single test using substring match. | ||
100 | $ ./run_tests -k test_cat_editor | ||
101 | ``` | ||
102 | |||
103 | The coverage isn't great currently, but it should still be run for all commits. | ||
76 | Adding more unittests for changes you make would be greatly appreciated :). | 104 | Adding more unittests for changes you make would be greatly appreciated :). |
77 | Check out the [tests/](./tests/) subdirectory for more details. | 105 | Check out the [tests/](./tests/) subdirectory for more details. |
78 | 106 | ||