Signed-off-by: Adam Hill <adam@diginc.us>
This commit is contained in:
Adam Hill 2018-07-11 23:23:32 -05:00
parent fff31558a0
commit 88e4b6390c
No known key found for this signature in database
GPG key ID: 2193804FCA429855
6 changed files with 35 additions and 2 deletions

4
.gitignore vendored
View file

@ -4,6 +4,10 @@
__pycache__ __pycache__
.cache .cache
.pytest_cache .pytest_cache
.tox
.eggs
*.egg-info
# Created by https://www.gitignore.io/api/jetbrains+iml # Created by https://www.gitignore.io/api/jetbrains+iml

View file

@ -9,6 +9,5 @@ install:
script: script:
# run tasks marked as 'build_stage' first (ensure docker images are built) # run tasks marked as 'build_stage' first (ensure docker images are built)
- py.test -vv -n auto -m "build_stage"
# run the remaining tasks in the test suite # run the remaining tasks in the test suite
- py.test -vv -n auto -m "not build_stage" - tox

View file

@ -3,3 +3,4 @@ pytest
pytest-xdist pytest-xdist
pytest-cov pytest-cov
testinfra testinfra
tox

6
setup.py Normal file
View file

@ -0,0 +1,6 @@
from setuptools import setup
setup(
setup_requires=['pytest-runner'],
tests_require=['pytest'],
)

13
test/README.md Normal file
View file

@ -0,0 +1,13 @@
# How do I test?
Make sure you have Docker and Python w/pip package manager.
From command line all you need to do is:
- `pip install tox`
- `tox`
# How do I debug python?
Highly recommended: Setup PyCharm on a **Docker enabled** machine. Having a python debugger like PyCharm changes your life if you've never used it :)

10
tox.ini Normal file
View file

@ -0,0 +1,10 @@
[tox]
envlist = py27
[testenv]
whitelist_externals = docker
deps = -rrequirements.txt
commands = docker build -f test/debian.Dockerfile -t pytest_pihole:debian .
docker build -f test/centos.Dockerfile -t pytest_pihole:centos .
docker build -f test/fedora.Dockerfile -t pytest_pihole:fedora .
pytest {posargs:-vv -n auto} -m "not build_stage" ./test/