- Timestamp:
- Jan 2, 2020, 4:51:45 PM (13 months ago)
- Branches:
- asyncio, master, proxy-ticket
- Children:
- 076049a
- Parents:
- 4411426
- Location:
- test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
test/README.md
r4411426 re971a2c 83 83 84 84 * `hooks.py` [optional] -- Defines hook functions that modify or 85 override the default behavior of runtest.py 85 override the default behavior of `runtest.py`. Please see the module 86 documentation of [mgstest.hooks](./mgstest/hooks.py) for details. 86 87 87 88 The [`runtest.py`](./runtest.py) program is used to start the required -
test/mgstest/hooks.py
r4411426 re971a2c 1 """Test case hooks for mod_gnutls tests 1 """Test case hooks for mod_gnutls tests. 2 2 3 3 Test cases can implement hooks that (depending on the hook) override 4 or supplement the default test run behavior.""" 4 or supplement the default test run behavior. Two hooks are currently 5 supported: 6 7 run_connection: 8 9 Will be called *instead* of mgstests.tests.run_test_conf() and 10 is expected to run whatever client actions the test 11 requires. This hook receives three parameters: 12 13 * testname: string containing the test name 14 * conn_log: file object for connection logging 15 * response_log: file object for HTTP response logging 16 17 18 post_check: 19 20 Execute additional checks if desired. This hook is called 21 after the test client run and after the test environment 22 terminates. This hook receives two parameters: 23 24 * conn_log: file object with connection log data 25 * response_log: file object with HTTP response log data 26 27 With the default client implementation conn_log will contain 28 gnutls-cli output, and response_log the full HTTP responses 29 (including status line and headers). 30 31 """ 5 32 6 33 import importlib.util … … 15 42 16 43 class Plugin: 44 """Represents a set of hooks. 45 46 All attribute names listed in the "hooks" field are guaranteed to 47 exist in an instance of this class, with the value of each being 48 either None or a function. 49 50 """ 17 51 def __init__(self, module=None): 18 52 self.module = module … … 27 61 setattr(self, hook, None) 28 62 29 def load_module_file(file_path, module_name='mgstest.plugin'): 63 def load_module_file(file_path, module_name): 64 """Load a module from a file path.""" 30 65 spec = importlib.util.spec_from_file_location(module_name, file_path) 31 66 module = importlib.util.module_from_spec(spec)
Note: See TracChangeset
for help on using the changeset viewer.