summaryrefslogtreecommitdiffstats
path: root/scripts/automation/regression/functional_unit_tests.py
blob: 30e915c45d076330e3f183baa44d0549935248ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/router/bin/python

__copyright__ = "Copyright 2014"



import os
import sys
import outer_packages
import nose
from nose.plugins import Plugin
import logging
from rednose import RedNose
import termstyle




def set_report_dir (report_dir):
    if not os.path.exists(report_dir):
        os.mkdir(report_dir)

if __name__ == "__main__":
    
    # setting defaults. By default we run all the test suite
    specific_tests    = False
    disableLogCapture = False
    long_test         = False
    report_dir        = "reports"

    nose_argv= sys.argv + ['-s', '-v', '--exe', '--rednose', '--detailed-errors']
    
#   for arg in sys.argv:
#       if 'unit_tests/' in arg:
#           specific_tests = True
#       if 'log-path' in arg:
#           disableLogCapture = True
#       if arg=='--collect-only':   # this is a user trying simply to view the available tests. removing xunit param from nose args
#           nose_argv[5:7] = []
            


    try:
        result = nose.run(argv = nose_argv, addplugins = [RedNose()])
        
        if (result == True):
            print termstyle.green("""
                     ..::''''::..
                   .;''        ``;.
                  ::    ::  ::    ::
                 ::     ::  ::     ::
                 ::     ::  ::     ::
                 :: .:' ::  :: `:. ::
                 ::  :          :  ::
                  :: `:.      .:' ::
                   `;..``::::''..;'
                     ``::,,,,::''

                   ___  ___   __________
                  / _ \/ _ | / __/ __/ /
                 / ___/ __ |_\ \_\ \/_/ 
                /_/  /_/ |_/___/___(_)  

            """)
            sys.exit(0)
        else:
            sys.exit(-1)
    
    finally:
        pass