Changeset e971a2c in mod_gnutls


Ignore:
Timestamp:
Jan 2, 2020, 4:51:45 PM (3 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
master
Children:
076049a
Parents:
4411426
Message:

Document supported test hooks

Location:
test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • test/README.md

    r4411426 re971a2c  
    8383
    8484* `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.
    8687
    8788The [`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.
    22
    33Test cases can implement hooks that (depending on the hook) override
    4 or supplement the default test run behavior."""
     4or supplement the default test run behavior. Two hooks are currently
     5supported:
     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"""
    532
    633import importlib.util
     
    1542
    1643class 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    """
    1751    def __init__(self, module=None):
    1852        self.module = module
     
    2761                setattr(self, hook, None)
    2862
    29 def load_module_file(file_path, module_name='mgstest.plugin'):
     63def load_module_file(file_path, module_name):
     64    """Load a module from a file path."""
    3065    spec = importlib.util.spec_from_file_location(module_name, file_path)
    3166    module = importlib.util.module_from_spec(spec)
Note: See TracChangeset for help on using the changeset viewer.