Skip to content

Commit 42c7e79

Browse files
committed
Add section describing how to run tests
1 parent a7c158a commit 42c7e79

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,42 @@ $ pip install cmd2-submenu
99

1010
## How to use
1111

12+
## Running tests
13+
14+
`cmd2` uses a three tiered testing strategy to test on multiple versions
15+
of python on various platforms. This plugin uses the same strategy:
16+
17+
- [pytest](https://pytest.org) runs the unit tests
18+
- [tox](https://tox.readthedocs.io/) runs the unit tests on multiple versions
19+
of python
20+
- [AppVeyor](https://www.appveyor.com/) and [TravisCI](https://travis-ci.com)
21+
run the tests on the various supported platforms
22+
23+
### Running unit tests
24+
25+
Run `pytest` from the top level directory of this plugin to run all the
26+
unit tests.
27+
28+
### Use tox to run unit tests in multiple versions of python
29+
30+
The included `tox.ini` is setup to run the unit tests in python 3.4, 3.5,
31+
and 3.6. In order for `tox` to work, you need to have different versions of
32+
python executables available in your path.
33+
[pyenv](https://github.com/pyenv/pyenv) is one method of doing this easily.
34+
Once `pyenv` is installed, use it to install multiple versions of python:
35+
36+
```
37+
$ pyenv install 3.4.8
38+
$ pyenv install 3.5.5
39+
$ pyenv install 3.6.5
40+
$ pyenv local 3.6.5 3.5.5 3.4.8
41+
```
42+
43+
This will create a `.python-version` file and instruct the `pyenv` shims
44+
to make `python3.6`, `python3.5`, and `python3.4` launch the appropriate
45+
versions of python.
46+
47+
Once these executables are configured, invoking `tox` will create a
48+
virtual environment for each version of python, install the prerequisite
49+
packages, and run your unit tests.
50+

0 commit comments

Comments
 (0)