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