aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2010-04-14 13:17:53 +0200
committerOlivier Tilloy <olivier@tilloy.net>2010-04-14 13:17:53 +0200
commit1f28278abbabe63e5c3061566fa41e643a289734 (patch)
treef23a995375f5923f65f268d25bdcd9c0da56d41c
parent466ab6bf71c2fdb98a2b309cff0d8a4753ed74b3 (diff)
downloadpyexiv2-1f28278abbabe63e5c3061566fa41e643a289734.tar.gz
The test scons target is now aware of the result of running the test suite.
-rw-r--r--SConstruct7
-rw-r--r--test/SConscript14
2 files changed, 16 insertions, 5 deletions
diff --git a/SConstruct b/SConstruct
index 05393a7..5422ccd 100644
--- a/SConstruct
+++ b/SConstruct
@@ -27,11 +27,7 @@ def build_doc():
def run_tests():
_fiddle_with_pythonpath()
- from test.TestsRunner import run_unit_tests
- # FIXME: this is not really well integrated as scons is not informed
- # whether the unit tests passed or failed.
- # http://www.scons.org/wiki/UnitTests may be of use.
- result = run_unit_tests()
+ SConscript('test/SConscript')
if not BUILD_TARGETS:
# Default target: lib
@@ -44,5 +40,6 @@ else:
# module to be in the python path.
build_doc()
if 'test' in BUILD_TARGETS:
+ # Note: running the unit tests requires the lib to be built.
run_tests()
diff --git a/test/SConscript b/test/SConscript
new file mode 100644
index 0000000..f1efb4e
--- /dev/null
+++ b/test/SConscript
@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+
+from TestsRunner import run_unit_tests
+
+def tests_builder(target, source, env):
+ result = run_unit_tests()
+ if result.wasSuccessful():
+ return None
+ else:
+ return result.errors + result.failures
+
+env = Environment()
+env.Command('test', None, tests_builder)
+