davemds pushed a commit to branch master.

http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=4a533f73dfabc95750c9e386b7e666cafec06d7a

commit 4a533f73dfabc95750c9e386b7e666cafec06d7a
Author: Dave Andreoli <d...@gurumeditation.it>
Date:   Tue Jan 20 01:35:27 2015 +0100

    New setup.py command: test
    
    This command run all the available unit test, will be used also in jenkins
---
 Makefile |  6 +++---
 setup.py | 28 ++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index f9243b5..8466626 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/setup.py b/setup.py
index eca2b04..2ad00ed 100755
--- a/setup.py
+++ b/setup.py
@@ -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,

-- 


Reply via email to