mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-09 12:54:17 +00:00
Merge pull request #95 from pre-commit/run_pre_commit_during_test
Run pre-commit during test
This commit is contained in:
commit
61d3e60a20
7 changed files with 20 additions and 21 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
- repo: git@github.com:pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
sha: 9ba5af45ce2d29b64c9a348a6fcff5553eea1f2c
|
sha: 9ba5af45ce2d29b64c9a348a6fcff5553eea1f2c
|
||||||
hooks:
|
hooks:
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
|
|
@ -12,12 +12,13 @@
|
||||||
- id: name-tests-test
|
- id: name-tests-test
|
||||||
- id: requirements-txt-fixer
|
- id: requirements-txt-fixer
|
||||||
- id: flake8
|
- id: flake8
|
||||||
- repo: git@github.com:pre-commit/pre-commit
|
- repo: https://github.com/pre-commit/pre-commit
|
||||||
sha: 8dba3281d5051060755459dcf88e28fc26c27526
|
sha: 8dba3281d5051060755459dcf88e28fc26c27526
|
||||||
hooks:
|
hooks:
|
||||||
- id: validate_config
|
- id: validate_config
|
||||||
- id: validate_manifest
|
- id: validate_manifest
|
||||||
- repo: git@github.com:asottile/reorder_python_imports
|
- repo: https://github.com/asottile/reorder_python_imports
|
||||||
sha: 3d86483455ab5bd06cc1069fdd5ac57be5463f10
|
sha: 3d86483455ab5bd06cc1069fdd5ac57be5463f10
|
||||||
hooks:
|
hooks:
|
||||||
- id: reorder-python-imports
|
- id: reorder-python-imports
|
||||||
|
language_version: python2.7
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ env: # These should match the tox env list
|
||||||
- TOXENV=py34
|
- TOXENV=py34
|
||||||
- TOXENV=pypy
|
- TOXENV=pypy
|
||||||
- TOXENV=pypy3
|
- TOXENV=pypy3
|
||||||
install: pip install coveralls tox --use-mirrors
|
install: pip install coveralls tox
|
||||||
script: tox
|
script: tox
|
||||||
# Special snowflake. Our tests depend on making real commits.
|
# Special snowflake. Our tests depend on making real commits.
|
||||||
before_install:
|
before_install:
|
||||||
|
|
@ -15,3 +15,7 @@ before_install:
|
||||||
after_success:
|
after_success:
|
||||||
- coveralls
|
- coveralls
|
||||||
sudo: false
|
sudo: false
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- $HOME/.cache/pip
|
||||||
|
- $HOME/.pre-commit
|
||||||
|
|
|
||||||
7
Makefile
7
Makefile
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
REBUILD_FLAG =
|
REBUILD_FLAG =
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|
@ -13,15 +12,13 @@ tests: test
|
||||||
test: .venv.touch
|
test: .venv.touch
|
||||||
tox $(REBUILD_FLAG)
|
tox $(REBUILD_FLAG)
|
||||||
|
|
||||||
|
.venv.touch: setup.py requirements-dev.txt
|
||||||
.venv.touch: setup.py requirements.txt requirements-dev.txt
|
|
||||||
$(eval REBUILD_FLAG := --recreate)
|
$(eval REBUILD_FLAG := --recreate)
|
||||||
touch .venv.touch
|
touch .venv.touch
|
||||||
|
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
find . -iname '*.pyc' | xargs rm -f
|
find . -name '*.pyc' -delete
|
||||||
rm -rf .tox
|
rm -rf .tox
|
||||||
rm -rf ./venv-*
|
rm -rf ./venv-*
|
||||||
rm -f .venv.touch
|
rm -f .venv.touch
|
||||||
|
|
|
||||||
|
|
@ -15,3 +15,7 @@ before_test:
|
||||||
- git config --global user.email "user@example.com"
|
- git config --global user.email "user@example.com"
|
||||||
|
|
||||||
test_script: tox
|
test_script: tox
|
||||||
|
|
||||||
|
cache:
|
||||||
|
- '%LOCALAPPDATA%\pip\cache'
|
||||||
|
- '%USERPROFILE%\.pre-commit'
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
.
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import pytest
|
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from pre_commit_hooks.pretty_format_json import pretty_format_json
|
from pre_commit_hooks.pretty_format_json import pretty_format_json
|
||||||
from testing.util import get_resource_path
|
from testing.util import get_resource_path
|
||||||
|
|
||||||
|
|
|
||||||
13
tox.ini
13
tox.ini
|
|
@ -4,27 +4,20 @@ project = pre_commit_hooks
|
||||||
envlist = py26,py27,py33,py34,pypy,pypy3
|
envlist = py26,py27,py33,py34,pypy,pypy3
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
install_command = pip install --use-wheel {opts} {packages}
|
|
||||||
deps = -rrequirements-dev.txt
|
deps = -rrequirements-dev.txt
|
||||||
passenv = HOME HOMEPATH LANG
|
passenv = HOME HOMEPATH PROGRAMDATA
|
||||||
commands =
|
commands =
|
||||||
coverage erase
|
coverage erase
|
||||||
coverage run -m pytest {posargs:tests}
|
coverage run -m pytest {posargs:tests}
|
||||||
coverage report --show-missing --fail-under 100
|
coverage report --show-missing --fail-under 100
|
||||||
flake8 {[tox]project} testing tests setup.py
|
pre-commit install -f --install-hooks
|
||||||
|
pre-commit run --all-files
|
||||||
pylint {[tox]project} testing tests setup.py
|
pylint {[tox]project} testing tests setup.py
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
envdir = venv-{[tox]project}
|
envdir = venv-{[tox]project}
|
||||||
commands =
|
commands =
|
||||||
|
|
||||||
[testenv:docs]
|
|
||||||
deps =
|
|
||||||
{[testenv]deps}
|
|
||||||
sphinx
|
|
||||||
changedir = docs
|
|
||||||
commands = sphinx-build -b html -d build/doctrees source build/html
|
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
max-line-length=131
|
max-line-length=131
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue