1 |
|
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 |
# Extensions to Scons |
12 |
|
13 |
import py_compile |
14 |
import sys |
15 |
import os |
16 |
import time |
17 |
|
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 |
|
23 |
# Code to run unit_test executables |
24 |
def runUnitTest(target, source, env): |
25 |
time_start = time.time() |
26 |
app = str(source[0].abspath) |
27 |
if not env.Execute(app): |
28 |
open(str(target[0]),'w').write("PASSED\n") |
29 |
else: |
30 |
return 1 |
31 |
print "Test execution time: ", round(time.time() - time_start), "seconds wall time" |
32 |
return None |
33 |
|
34 |
def runPyUnitTest(target, source, env): |
35 |
time_start = time.time() |
36 |
app = 'python '+str(source[0].abspath) |
37 |
if not env.Execute(app): |
38 |
open(str(target[0]),'w').write("PASSED\n") |
39 |
else: |
40 |
return 1 |
41 |
print "Test execution time: ", round(time.time() - time_start), "seconds wall time" |
42 |
return None |