1 |
elspeth |
645 |
|
2 |
|
|
# Copyright 2006 by ACcESS MNRF |
3 |
|
|
# |
4 |
|
|
# http://www.access.edu.au |
5 |
|
|
# Primary Business: Queensland, Australia |
6 |
|
|
# Licensed under the Open Software License version 3.0 |
7 |
|
|
# http://www.opensource.org/licenses/osl-3.0.php |
8 |
|
|
# |
9 |
|
|
|
10 |
|
|
|
11 |
jgs |
268 |
# Extensions to Scons |
12 |
|
|
|
13 |
|
|
import py_compile |
14 |
|
|
import sys |
15 |
jgs |
297 |
import os |
16 |
gross |
763 |
import time |
17 |
jgs |
268 |
|
18 |
|
|
# Code to build .pyc from .py |
19 |
|
|
def build_py(target, source, env): |
20 |
|
|
py_compile.compile(str(source[0]), str(target[0])) |
21 |
|
|
return None |
22 |
jgs |
297 |
|
23 |
|
|
# Code to run unit_test executables |
24 |
|
|
def runUnitTest(target, source, env): |
25 |
ksteube |
760 |
time_start = time.time() |
26 |
ksteube |
774 |
print "Executing test: " + str(source[0].abspath) |
27 |
jgs |
297 |
app = str(source[0].abspath) |
28 |
robwdcock |
682 |
if not env.Execute(app): |
29 |
jgs |
297 |
open(str(target[0]),'w').write("PASSED\n") |
30 |
jgs |
359 |
else: |
31 |
|
|
return 1 |
32 |
ksteube |
774 |
print "Test execution time: ", round(time.time() - time_start, 1), " seconds wall time for " + str(source[0].abspath) |
33 |
jgs |
297 |
return None |
34 |
cochrane |
370 |
|
35 |
robwdcock |
682 |
def runPyUnitTest(target, source, env): |
36 |
ksteube |
760 |
time_start = time.time() |
37 |
ksteube |
774 |
print "Executing test: " + str(source[0].abspath) |
38 |
robwdcock |
682 |
app = 'python '+str(source[0].abspath) |
39 |
|
|
if not env.Execute(app): |
40 |
|
|
open(str(target[0]),'w').write("PASSED\n") |
41 |
|
|
else: |
42 |
|
|
return 1 |
43 |
ksteube |
774 |
print "Test execution time: ", round(time.time() - time_start, 1), " seconds wall time for " + str(source[0].abspath) |
44 |
robwdcock |
682 |
return None |