1#!/usr/bin/env python3
2
3class TdcPlugin:
4    def __init__(self):
5        super().__init__()
6        print(' -- {}.__init__'.format(self.sub_class))
7
8    def pre_suite(self, testcount, testidlist):
9        '''run commands before test_runner goes into a test loop'''
10        self.testcount = testcount
11        self.testidlist = testidlist
12        if self.args.verbose > 1:
13            print(' -- {}.pre_suite'.format(self.sub_class))
14
15    def post_suite(self, index):
16        '''run commands after test_runner completes the test loop
17        index is the last ordinal number of test that was attempted'''
18        if self.args.verbose > 1:
19            print(' -- {}.post_suite'.format(self.sub_class))
20
21    def pre_case(self, testid, test_name, test_skip):
22        '''run commands before test_runner does one test'''
23        if self.args.verbose > 1:
24            print(' -- {}.pre_case'.format(self.sub_class))
25        self.args.testid = testid
26        self.args.test_name = test_name
27        self.args.test_skip = test_skip
28
29    def post_case(self):
30        '''run commands after test_runner does one test'''
31        if self.args.verbose > 1:
32            print(' -- {}.post_case'.format(self.sub_class))
33
34    def pre_execute(self):
35        '''run command before test-runner does the execute step'''
36        if self.args.verbose > 1:
37            print(' -- {}.pre_execute'.format(self.sub_class))
38
39    def post_execute(self):
40        '''run command after test-runner does the execute step'''
41        if self.args.verbose > 1:
42            print(' -- {}.post_execute'.format(self.sub_class))
43
44    def adjust_command(self, stage, command):
45        '''adjust the command'''
46        if self.args.verbose > 1:
47            print(' -- {}.adjust_command {}'.format(self.sub_class, stage))
48
49        # if stage == 'pre':
50        #     pass
51        # elif stage == 'setup':
52        #     pass
53        # elif stage == 'execute':
54        #     pass
55        # elif stage == 'verify':
56        #     pass
57        # elif stage == 'teardown':
58        #     pass
59        # elif stage == 'post':
60        #     pass
61        # else:
62        #     pass
63
64        return command
65
66    def add_args(self, parser):
67        '''Get the plugin args from the command line'''
68        self.argparser = parser
69        return self.argparser
70
71    def check_args(self, args, remaining):
72        '''Check that the args are set correctly'''
73        self.args = args
74        if self.args.verbose > 1:
75            print(' -- {}.check_args'.format(self.sub_class))
76