Run pre-commit during test

This commit is contained in:
Anthony Sottile 2015-12-25 09:37:18 -08:00
parent e306ff3b7d
commit 3a3a7a153a
7 changed files with 20 additions and 21 deletions

View File

@ -1,4 +1,4 @@
- repo: git@github.com:pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
sha: 9ba5af45ce2d29b64c9a348a6fcff5553eea1f2c
hooks:
- id: trailing-whitespace
@ -12,12 +12,13 @@
- id: name-tests-test
- id: requirements-txt-fixer
- id: flake8
- repo: git@github.com:pre-commit/pre-commit
- repo: https://github.com/pre-commit/pre-commit
sha: 8dba3281d5051060755459dcf88e28fc26c27526
hooks:
- id: validate_config
- id: validate_manifest
- repo: git@github.com:asottile/reorder_python_imports
- repo: https://github.com/asottile/reorder_python_imports
sha: 3d86483455ab5bd06cc1069fdd5ac57be5463f10
hooks:
- id: reorder-python-imports
language_version: python2.7

View File

@ -6,7 +6,7 @@ env: # These should match the tox env list
- TOXENV=py34
- TOXENV=pypy
- TOXENV=pypy3
install: pip install coveralls tox --use-mirrors
install: pip install coveralls tox
script: tox
# Special snowflake. Our tests depend on making real commits.
before_install:
@ -15,3 +15,7 @@ before_install:
after_success:
- coveralls
sudo: false
cache:
directories:
- $HOME/.cache/pip
- $HOME/.pre-commit

View File

@ -1,4 +1,3 @@
REBUILD_FLAG =
.PHONY: all
@ -13,15 +12,13 @@ tests: test
test: .venv.touch
tox $(REBUILD_FLAG)
.venv.touch: setup.py requirements.txt requirements-dev.txt
.venv.touch: setup.py requirements-dev.txt
$(eval REBUILD_FLAG := --recreate)
touch .venv.touch
.PHONY: clean
clean:
find . -iname '*.pyc' | xargs rm -f
find . -name '*.pyc' -delete
rm -rf .tox
rm -rf ./venv-*
rm -f .venv.touch

View File

@ -15,3 +15,7 @@ before_test:
- git config --global user.email "user@example.com"
test_script: tox
cache:
- '%LOCALAPPDATA%\pip\cache'
- '%USERPROFILE%\.pre-commit'

View File

@ -1 +0,0 @@
.

View File

@ -1,6 +1,7 @@
import pytest
import tempfile
import pytest
from pre_commit_hooks.pretty_format_json import pretty_format_json
from testing.util import get_resource_path

13
tox.ini
View File

@ -4,27 +4,20 @@ project = pre_commit_hooks
envlist = py26,py27,py33,py34,pypy,pypy3
[testenv]
install_command = pip install --use-wheel {opts} {packages}
deps = -rrequirements-dev.txt
passenv = HOME HOMEPATH LANG
passenv = HOME HOMEPATH PROGRAMDATA
commands =
coverage erase
coverage run -m pytest {posargs:tests}
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
[testenv:venv]
envdir = venv-{[tox]project}
commands =
[testenv:docs]
deps =
{[testenv]deps}
sphinx
changedir = docs
commands = sphinx-build -b html -d build/doctrees source build/html
[flake8]
max-line-length=131