blob: 940cded8258b63cd08aec3e7ba8564f188f75840 (
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
|
#IF COMMAND IS NEEDED
from test.helpers.syscmd import SysCommand
import unittest
#class name
class Qtemplate(unittest.TestCase):
# Initialize the variables
__variable1 = "Value-a"
__variable2 = "Value-b"
#....
__variablen = "Value-n"
def __init__(self, testname, testfunc, input1=None, inputn=None):
# Doing this we will initialize the class and later on perform a particular method inside this class
super(Qtemplate, self).__init__(testfunc)
self.__testname = testname
self.__input1 = input1
self.__inputn = inputn
self._testMethodDoc = testname
def execute(self):
str_cmd = "command"
t = SysCommand("command-name", str_cmd)
if t.execute() == 0:
self.__raw_out = t.getOutput()
if self.__raw_out == "":
return -1
lines = t.getOutput().splitlines()
dat = lines[1]
dat = dat.decode('ascii')
dat_list = dat.split( )
for d in dat_list:
a = dat_list.pop(0)
if a == "sec":
break
self.__MB_real = dat_list[0]
self.__BW_real = dat_list[2]
self.__dat_list = dat_list
print(self.__MB_real)
print(self.__BW_real)
self.failUnless(int(self.__BW_real)>int(self.__OKBW)*0.9,"FAIL:BECAUSE...")
else:
return -1
return 0
def get_Total_MB(self):
return self.__MB_real;
def get_Total_BW(self):
return self.__MB_real;
|