From 88e4b6390c77f641cf15fceea77c1d453aa0e0d7 Mon Sep 17 00:00:00 2001 From: Adam Hill Date: Wed, 11 Jul 2018 23:23:32 -0500 Subject: [PATCH] Tox! Signed-off-by: Adam Hill --- .gitignore | 4 ++++ .travis.yml | 3 +-- requirements.txt | 1 + setup.py | 6 ++++++ test/README.md | 13 +++++++++++++ tox.ini | 10 ++++++++++ 6 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 setup.py create mode 100644 test/README.md create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 91bb6aff..1e80dfb8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,10 @@ __pycache__ .cache .pytest_cache +.tox +.eggs +*.egg-info + # Created by https://www.gitignore.io/api/jetbrains+iml diff --git a/.travis.yml b/.travis.yml index 563ec131..eaaff197 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,5 @@ install: script: # 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 - - py.test -vv -n auto -m "not build_stage" + - tox diff --git a/requirements.txt b/requirements.txt index 53737ca5..f2c61e42 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,4 @@ pytest pytest-xdist pytest-cov testinfra +tox diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..0e393bc1 --- /dev/null +++ b/setup.py @@ -0,0 +1,6 @@ +from setuptools import setup + +setup( + setup_requires=['pytest-runner'], + tests_require=['pytest'], +) diff --git a/test/README.md b/test/README.md new file mode 100644 index 00000000..07f6c539 --- /dev/null +++ b/test/README.md @@ -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 :) + diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..e7916e04 --- /dev/null +++ b/tox.ini @@ -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/