TdcPlugin.py 2.4 KB

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