Main function. This should not be overridden by the subclass test scripts.
(self)
| 133 | self.rpc_timeout = int(self.rpc_timeout * self.options.timeout_factor) # optionally, increase timeout by a factor |
| 134 | |
| 135 | def main(self): |
| 136 | """Main function. This should not be overridden by the subclass test scripts.""" |
| 137 | |
| 138 | assert hasattr(self, "num_nodes"), "Test must set self.num_nodes in set_test_params()" |
| 139 | |
| 140 | try: |
| 141 | self.setup() |
| 142 | if self.options.test_methods: |
| 143 | self.run_test_methods() |
| 144 | else: |
| 145 | self.run_test() |
| 146 | |
| 147 | except SkipTest as e: |
| 148 | self.log.warning("Test Skipped: %s" % e.message) |
| 149 | self.success = TestStatus.SKIPPED |
| 150 | except subprocess.CalledProcessError as e: |
| 151 | self.log.exception(f"Called Process failed with stdout='{e.stdout}'; stderr='{e.stderr}';") |
| 152 | self.success = TestStatus.FAILED |
| 153 | except BaseException: |
| 154 | # The `exception` log will add the exception info to the message. |
| 155 | # https://docs.python.org/3/library/logging.html#logging.exception |
| 156 | self.log.exception("Unexpected exception:") |
| 157 | self.success = TestStatus.FAILED |
| 158 | finally: |
| 159 | exit_code = self.shutdown() |
| 160 | sys.exit(exit_code) |
| 161 | |
| 162 | def run_test_methods(self): |
| 163 | for method_name in self.options.test_methods: |
no test coverage detected