From: Thomas Fillon Date: Mon, 14 Apr 2014 21:06:57 +0000 (+0200) Subject: Add a test section (pytest) for setuptools setup.py X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=18d9600a89e85d338f7a39fb06d0c06d57a625af;p=timeside-diadems.git Add a test section (pytest) for setuptools setup.py --- diff --git a/setup.py b/setup.py index a36cbe6..dc0ce4d 100755 --- 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}, + )