1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 import sys
24
25
27 """Function for printing the subtitles.
28
29 @param text: The text of the subtitle to be printed.
30 @type text: str
31 """
32
33
34 width = len(text) + 2
35
36
37 sys.stdout.write("# %s\n" % text)
38
39
40 sys.stdout.write("#" * width)
41
42
43 sys.stdout.write("\n\n")
44
45
47 """Print a summary line.
48
49 @param name: The name of the test, test category, etc.
50 @type name: str
51 @param passed: An argument which if True causes '[ OK ]' to be printed and if False causes '[ Failed ]' to be printed. The special string 'skip' is used to indicate that this has been skipped.
52 @type passed: bool or str
53 @keyword width: The width of the line, excluding the terminal '[ OK ]' or '[ Failed ]'.
54 @type width: int
55 """
56
57
58 if passed == True:
59 state = "OK"
60
61
62 elif passed == 'skip':
63 state = "Skipped"
64
65
66 else:
67 state = "Failed"
68
69
70 dots = ''
71 for j in range(width - len(name) - len(state) - 6):
72 dots += '.'
73
74
75 sys.stdout.write("%s %s [ %s ]\n" % (name, dots, state))
76
77
79 """Function for printing the titles.
80
81 @param text: The text of the title to be printed.
82 @type text: str
83 """
84
85
86 width = len(text) + 4
87
88
89 sys.stdout.write("\n\n\n\n")
90
91
92 sys.stdout.write("#" * width)
93 sys.stdout.write("\n")
94
95
96 sys.stdout.write("# %s #\n" % text)
97
98
99 sys.stdout.write("#" * width)
100
101
102 sys.stdout.write("\n\n\n")
103