Add tox, pre-commit and dummy test.

This commit is contained in:
IamTheFij 2018-04-09 10:44:30 -07:00
parent f9ed9d6a2a
commit 5edc2410ea
6 changed files with 69 additions and 1 deletions

1
.gitignore vendored
View File

@ -44,6 +44,7 @@ htmlcov/
nosetests.xml nosetests.xml
coverage.xml coverage.xml
*,cover *,cover
.pytest_cache/
# Translations # Translations
*.mo *.mo

24
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,24 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.2.3
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: autopep8-wrapper
args:
- -i
- --ignore=E265,E309,E501
- id: debug-statements
language_version: python3
- id: flake8
language_version: python3
- id: check-yaml
- id: check-merge-conflict
- id: name-tests-test
exclude: tests/(common.py|util.py|(helpers|integration/factories)/(.+).py)
- repo: https://github.com/asottile/reorder_python_imports
sha: v1.0.1
hooks:
- id: reorder-python-imports
args:
- --py3-plus

View File

@ -1,11 +1,15 @@
env: env:
virtualenv -p python3 env virtualenv -p python3 env
./env/bin/pip install -r requirements.txt ./env/bin/pip install -r requirements-dev.txt
.PHONY: run .PHONY: run
run: env run: env
./env/bin/python -m minitor.main ./env/bin/python -m minitor.main
.PHONY: test
test: env
tox
.PHONY: build .PHONY: build
build: env build: env
./env/bin/python setup.py sdist ./env/bin/python setup.py sdist
@ -22,3 +26,6 @@ upload-test: env
.PHONY: clean .PHONY: clean
clean: clean:
rm -fr ./build ./dist ./minitor.egg-info rm -fr ./build ./dist ./minitor.egg-info
install-hooks:
tox -e pre-commit -- install -f --install-hooks

View File

@ -1,3 +1,9 @@
-r requirements.txt -r requirements.txt
coverage
flake8
mock
pre-commit
pytest
tox
twine twine
wheel wheel

6
tests/first_test.py Normal file
View File

@ -0,0 +1,6 @@
class TestMain(object):
def test_something(self):
pass
def test_something_else(self):
assert False

24
tox.ini Normal file
View File

@ -0,0 +1,24 @@
[tox]
envlist = py3
[testenv]
deps =
-rrequirements-dev.txt
commands =
coverage erase
coverage run --source=minitor/,tests/ -m pytest --capture=no -vv {posargs:tests}
coverage report -m --fail-under 50
pre-commit run --all-files
[testenv:pre-commit]
commands =
pre-commit {posargs}
[flake8]
exclude = .svn,CVS,.bzr,.hg,.git,__pycache__,.ropeproject,.tox,docs,virtualenv_run
filename = *.py,*.wsgi
max-line-length = 80
ignore = F403
[pytest]
norecursedirs = .* _darcs CVS docs virtualenv_run