From d0a0a6f2cc4229d6943ebd22517bb6995415f9aa Mon Sep 17 00:00:00 2001 From: Matthias Volk Date: Tue, 20 Dec 2016 17:56:50 +0100 Subject: [PATCH] Run tests from setup.py --- setup.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 3362884..71e1812 100755 --- a/setup.py +++ b/setup.py @@ -5,6 +5,7 @@ import subprocess from setuptools import setup, Extension from setuptools.command.build_ext import build_ext +from setuptools.command.test import test if sys.version_info[0] == 2: sys.exit('Sorry, Python 2.x is not supported') @@ -62,6 +63,13 @@ class CMakeBuild(build_ext): subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env) subprocess.check_call(['cmake', '--build', '.', '--target', ext.name] + build_args, cwd=self.build_temp) +class PyTest(test): + def run_tests(self): + #import here, cause outside the eggs aren't loaded + import pytest + errno = pytest.main(['tests']) + sys.exit(errno) + setup( name="stormpy", @@ -82,7 +90,7 @@ setup( CMakeExtension('storage', subdir='storage'), CMakeExtension('utility', subdir='utility') ], - cmdclass=dict(build_ext=CMakeBuild), + cmdclass=dict(build_ext=CMakeBuild, test=PyTest), zip_safe=False, - install_requires=['pytest'], + tests_require=['pytest'], )