New setup.py command: test

This command run all the available unit test, will be used also in jenkins
This commit is contained in:
Davide Andreoli 2015-01-20 01:35:27 +01:00
parent e44d8b176b
commit 4a533f73df
2 changed files with 31 additions and 3 deletions

View File

@ -34,9 +34,9 @@ doc:
$(PY) setup.py build build_doc
.PHONY: tests
tests:
$(PY) tests/00_run_all_tests.py
.PHONY: test
test:
$(PY) setup.py test
.PHONY: clean

View File

@ -3,6 +3,7 @@
import os
import sys
import platform
import subprocess
from distutils.core import setup, Command
from distutils.extension import Extension
@ -159,6 +160,32 @@ class Uninstall(Command):
self.remove_entry(entry)
# === setup.py test command ===
class Test(Command):
description = 'Run all the available unit tests using efl in build/'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import unittest
sys.path.insert(0, "build/lib.%s-%s-%d.%d" % (
platform.system().lower(), platform.machine(),
sys.version_info[0], sys.version_info[1]))
if "efl" in sys.modules:
del sys.modules["efl"]
loader = unittest.TestLoader()
suite = loader.discover('./tests')
runner = unittest.TextTestRunner(verbosity=1, buffer=True)
result = runner.run(suite)
# === use cython or pre-generated C files ===
USE_CYTHON = False
if os.getenv("DISABLE_CYTHON") is not None:
@ -473,6 +500,7 @@ setup(
'Topic :: Software Development :: Widget Sets',
],
cmdclass={
'test': Test,
'build_doc': BuildDoc,
'clean_generated_files': CleanGenerated,
'uninstall': Uninstall,