summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--SUBMITTING_PATCHES.md34
-rw-r--r--tox.ini22
3 files changed, 55 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index f6b74f3d..d4b230a1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,8 @@
1*.egg-info/ 1*.egg-info/
2*.log
2*.pyc 3*.pyc
3__pycache__ 4__pycache__
4/dist 5/dist
5.repopickle_* 6.repopickle_*
6/repoc 7/repoc
8/.tox
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
72There is a [`./run_tests`](./run_tests) helper script for quickly invoking all 72We use [pytest](https://pytest.org/) and [tox](https://tox.readthedocs.io/) for
73of our unittests. The coverage isn't great currently, but it should still be 73running tests. You should make sure to install those first.
74run for all commits.
75 74
75To run the full suite against all supported Python versions, simply execute:
76```sh
77$ tox -p auto
78```
79
80We 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
103The coverage isn't great currently, but it should still be run for all commits.
76Adding more unittests for changes you make would be greatly appreciated :). 104Adding more unittests for changes you make would be greatly appreciated :).
77Check out the [tests/](./tests/) subdirectory for more details. 105Check out the [tests/](./tests/) subdirectory for more details.
78 106
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 00000000..02c5647d
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,22 @@
1# Copyright 2019 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# https://tox.readthedocs.io/
16
17[tox]
18envlist = py27, py36, py37, py38
19
20[testenv]
21deps = pytest
22commands = {toxinidir}/run_tests