Skip to content

Commit 430a21e

Browse files
committed
Add pre-commit configuration and linting tox-env
1 parent 9223211 commit 430a21e

4 files changed

Lines changed: 35 additions & 2 deletions

File tree

.pre-commit-config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
exclude: '^($|.*\.bin)'
2+
repos:
3+
- repo: https://github.com/ambv/black
4+
rev: 19.10b0
5+
hooks:
6+
- id: black
7+
args: [--safe, --quiet]
8+
language_version: python3.6
9+
- repo: https://github.com/pre-commit/pre-commit-hooks
10+
rev: v2.5.0
11+
hooks:
12+
- id: trailing-whitespace
13+
- id: end-of-file-fixer
14+
- repo: local
15+
hooks:
16+
- id: rst
17+
name: rst
18+
entry: rst-lint --encoding utf-8
19+
files: README.rst
20+
language: python
21+
additional_dependencies: [pygments, restructuredtext_lint]

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
python: '3.8'
1515
- env: TOXENV=py38-pytest53
1616
python: '3.8'
17+
- env: TOXENV=linting
18+
python: '3.7'
1719
- stage: deploy
1820
python: '3.8'
1921
install: pip install -U setuptools setuptools_scm

README.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pytest-cpp
44

55
Use `pytest <https://pypi.python.org/pypi/pytest>`_ runner to discover and execute C++ tests.
66

7-
|python| |version| |anaconda| |ci| |coverage|
7+
|python| |version| |anaconda| |ci| |coverage| |black|
88

99
Supports both `Google Test <https://code.google.com/p/googletest>`_ and
1010
`Boost::Test <http://www.boost.org/doc/libs/release/libs/test>`_:
@@ -27,6 +27,9 @@ Supports both `Google Test <https://code.google.com/p/googletest>`_ and
2727
:target: https://pypi.python.org/pypi/pytest-cpp/
2828
:alt: Supported Python versions
2929

30+
.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
31+
:target: https://github.com/psf/black
32+
3033
This brings several benefits:
3134

3235
* Allows you to run all your tests in multi-language projects with a single

tox.ini

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ deps=
77
pytest53: pytest ~=5.3
88
pytest-mock
99
pytest-xdist
10-
coverage
10+
coverage
1111
commands=
1212
coverage run --source=pytest_cpp -m pytest tests
1313
pytest -n8 tests
14+
15+
[testenv:linting]
16+
skipsdist = True
17+
usedevelop = True
18+
extras = dev
19+
basepython = python3.7
20+
commands = pre-commit run --all-files --show-diff-on-failure

0 commit comments

Comments
 (0)