blob: ce45df91382acc73422ee3805ea509f21354db87 (
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
|
import pytest
import plugins.agl_test_log as log
from plugins.agl_test_ptest_base import PTESTBase
class GLIB2Base(PTESTBase):
def __init__(self):
super().__init__(test_name="glib-2.0")
def log_process(self):
log_file = self.get_logfile()
self.case_info_list = log.log_process_gnome_desktop_testing(log_file)
self.init_case_status()
@pytest.fixture(scope='module')
def testbase():
#init instance for test
instance = GLIB2Base()
#run test scripts
#the "test_name" should be the name of test set in ptest
instance.run_test_fun()
#parser log
instance.log_process()
yield instance
#package log files and make report file
instance.log_report()
def setup_module(testbase: GLIB2Base):
print("setup function start")
def precheck():
instance = GLIB2Base()
return instance.precheck()
skip_msg = "The current environment does not match the test requirements."
pytestmark = pytest.mark.skipif(precheck() == False, reason = skip_msg)
@pytest.mark.oss_default
def test_timeloop_closure(testbase: GLIB2Base):
name = "glib/timeloop-closure.test"
testbase.run_case(name)
@pytest.mark.oss_default
def test_contenttype(testbase: GLIB2Base):
name = "glib/contenttype.test"
testbase.run_case(name)
@pytest.mark.oss_default
def test_string(testbase: GLIB2Base):
name = "glib/string.test"
testbase.run_case(name)
#TODO:Completion test cases
if __name__ == '__main__':
pytest.main("-s run_tests")
|