main
Last change
on this file was
42bd667,
checked in by David Fuertes <dfuertes@…>, 4 years ago
|
Historial Limpio
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | #!/usr/bin/python3 |
---|
2 | |
---|
3 | import subprocess |
---|
4 | import os |
---|
5 | import sys |
---|
6 | import glob |
---|
7 | |
---|
8 | APP = os.path.basename(os.getcwd()) |
---|
9 | |
---|
10 | def start_unittests(dir): |
---|
11 | TEST_DIR = dir |
---|
12 | err = '' |
---|
13 | |
---|
14 | testFileList = glob.glob(os.getcwd() + '/' + TEST_DIR + '/test*.py') |
---|
15 | # Execute all test in directory |
---|
16 | for testFile in testFileList: |
---|
17 | # Framework web2py launch test script. It sets up the operating environment, |
---|
18 | # brings in our database and gives us all of the variables that are normally passed into the controller. |
---|
19 | command_str = os.getcwd().split('applications')[0] + 'web2py.py' + ' -S ' + APP + ' -M -R '+ os.getcwd() + \ |
---|
20 | '/' + TEST_DIR + '/' + os.path.basename(testFile) + \ |
---|
21 | ' -A ' + APP |
---|
22 | |
---|
23 | subprocess.run('python3 ' + command_str, shell=True) |
---|
24 | |
---|
25 | |
---|
26 | |
---|
27 | |
---|
28 | |
---|
29 | if __name__ == '__main__': |
---|
30 | if len(sys.argv) != 2: |
---|
31 | print(" Directory test is needed, Run:") |
---|
32 | print(" python runUnitTest.py UNITTEST_DIRECTORY") |
---|
33 | exit() |
---|
34 | else: |
---|
35 | start_unittests(sys.argv[1]) |
---|
Note: See
TracBrowser
for help on using the repository browser.