mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 11:36:54 +00:00
Merge 66a8778df5 into 78dffcc819
This commit is contained in:
commit
7afdbe4eeb
1 changed files with 52 additions and 0 deletions
52
tests/README.md
Normal file
52
tests/README.md
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
Testing
|
||||
=======
|
||||
|
||||
The test will run with the following environments:
|
||||
- Python version 2.7
|
||||
- Python version 3.5
|
||||
- Python version 3.6
|
||||
- PyPy
|
||||
|
||||
Installing the test environment
|
||||
-------------------------------
|
||||
|
||||
### Debian-based distributions (Ubuntu, Mint, etc.)
|
||||
|
||||
```shell-session
|
||||
$ sudo apt install pypy python2.7 python3.5 python3.6 python-tox
|
||||
```
|
||||
|
||||
Running the tests
|
||||
-----------------
|
||||
|
||||
### Running the complete test suite
|
||||
|
||||
```shell-session
|
||||
$ make test
|
||||
```
|
||||
|
||||
If the tests failed whereas [the ones from the last tag](https://travis-ci.org/pre-commit/pre-commit-hooks) did not, your Git configuration might interfere with `pre-commit-hooks`. In this case, you can ignore your current Git configuration by setting a temporary environment variable:
|
||||
|
||||
```shell-session
|
||||
$ env HOME=/tmp make test
|
||||
```
|
||||
|
||||
### Running only a specific test
|
||||
|
||||
If you are developing a new hook or adding features to an existing one, you may want to run the tests for that particular hook. The following command will run the wanted test on every supported Python version.
|
||||
|
||||
```shell-session
|
||||
$ tox tests/<your_test>.py
|
||||
```
|
||||
|
||||
If you want to run your test for a specific Python version (for a quicker execution), you can specify it with the `-e` option of `tox`. At the moment, the supported Python versions are `2.7` (`-e py27`), `3.5` (`-e py35`), and `3.6` (`-e py36`). For example:
|
||||
|
||||
```shell-session
|
||||
$ tox -e py27 tests/<your_test>.py
|
||||
```
|
||||
|
||||
You can run your specific test ignoring your own Git configuration like so:
|
||||
|
||||
```shell-session
|
||||
$ env HOME=/tmp tox -e py27 tests/<your_test>.py
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue