From b7cc12f9fcc90f81026523852144f7cfaab0193d Mon Sep 17 00:00:00 2001 From: Thomas Fillon Date: Mon, 14 Apr 2014 23:06:57 +0200 Subject: [PATCH] Add a test section (pytest) for setuptools setup.py --- setup.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) 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}, + ) -- 2.39.5