]> git.parisson.com Git - timeside-diadems.git/commitdiff
Add a test section (pytest) for setuptools setup.py
authorThomas Fillon <thomas@parisson.com>
Mon, 14 Apr 2014 21:06:57 +0000 (23:06 +0200)
committerThomas Fillon <thomas@parisson.com>
Mon, 14 Apr 2014 21:06:57 +0000 (23:06 +0200)
setup.py

index a36cbe68c2f2fb008a79582f8e9d2eb4074d3614..dc0ce4d20743c6c8ac1801acc1719298c93c903f 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,23 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 from setuptools import setup, find_packages
+import sys
+from setuptools.command.test import test as TestCommand
+
+# Pytest
+class PyTest(TestCommand):
+    def finalize_options(self):
+        TestCommand.finalize_options(self)
+        self.test_args = ['tests', '--ignore', 'tests/sandbox']
+        self.test_suite = True
+
+    def run_tests(self):
+        #import here, cause outside the eggs aren't loaded
+        import pytest
+        errno = pytest.main(self.test_args)
+        sys.exit(errno)
+
+
 
 CLASSIFIERS = [
     'Intended Audience :: Science/Research',
@@ -45,4 +62,6 @@ setup(
   include_package_data = True,
   zip_safe = False,
   scripts=['scripts/timeside-waveforms', 'scripts/timeside-launch'],
-)
+  tests_require=['pytest'],
+  cmdclass = {'test': PyTest},
+    )