commit 4844bb52c77eed6b43780a89bb4aeceb17bed48b
parent 195ef49ab68a6b8e2d4ca583deccb1870906f697
Author: Brian C. Lane <bcl@brianlane.com>
Date: Sat, 1 Jul 2017 12:49:11 -0700
A start to using some testing frameworks.
Haven't decided yet which to use, might use all of them.
Diffstat:
7 files changed, 79 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,3 +1,8 @@
*.swp
__pycache__
venv
+.eggs/
+.mypy_cache/
+.tox/
+TODO
+strix.egg-info/
diff --git a/requirements.txt b/pylint.rc
diff --git a/requirements.txt b/requirements.txt
@@ -0,0 +1,2 @@
+mypy
+pytest
diff --git a/setup.cfg b/setup.cfg
@@ -0,0 +1,13 @@
+[build_sphinx]
+source-dir = docs/
+build-dir = docs/_build
+all_files = 1
+
+[nosetests]
+verbosity=1
+detailed-errors=1
+with-coverage=1
+cover-package=strix
+debug=nose.loader
+pdb=1
+pdb-failures=1
diff --git a/setup.py b/setup.py
@@ -0,0 +1,38 @@
+from setuptools import setup, find_packages
+from setuptools.command.test import test as TestCommand
+import sys
+
+class Tox(TestCommand):
+ user_options = [('tox-args=', 'a', "Arguments to pass to tox")]
+ def initialize_options(self):
+ TestCommand.initialize_options(self)
+ self.tox_args = ""
+ def finalize_options(self):
+ TestCommand.finalize_options(self)
+ self.test_args = []
+ self.test_suite = True
+ def run_tests(self):
+ #import here, cause outside the eggs aren't loaded
+ import tox
+ import shlex
+
+ # It doesn't use the ini by default for some reason
+ self.tox_args += " -c tox.ini"
+ errno = tox.cmdline(args=shlex.split(self.tox_args))
+ sys.exit(errno)
+
+setup(
+ name="strix",
+ version="0.0.1",
+ packages=find_packages(),
+ setup_requires=['nose>=1.0', 'setuptools-lint'],
+ tests_require=['tox', 'coverage', 'nose', 'pylint'],
+ cmdclass={'test': Tox},
+
+ author="Brian Lane",
+ author_email="bcl@brianlane.com",
+ description="A Motion Camera API Server and UI",
+ license="NeedToDecide",
+ keywords="motion security camera strix",
+ url="https://www.brianlane.com/software/strix.html"
+)
diff --git a/testing-requirements.txt b/testing-requirements.txt
@@ -0,0 +1,6 @@
+coverage
+nose
+pylint
+pytest
+mypy
+tox
diff --git a/tox.ini b/tox.ini
@@ -0,0 +1,15 @@
+[tox]
+envlist = py35
+
+[testenv]
+deps=
+ coverage
+ nose
+ pylint
+ pytest
+ mypy
+commands=
+ mypy --strict --ignore-missing-imports src/motion/ src/strix/ bin/strix
+ pylint --rcfile=pylint.rc -E src/motion/ src/strix/ bin/strix
+ nosetests --with-coverage [] # substitute with tox' positional arguments
+ pytest -v