Skip to content

The test-tunnel common definitions module

test_tunnel.defs

Common definitions for the tunnel testing library.

Configuration classes

test_tunnel.defs.Config dataclass

Common configuration for the tunnel testing library.

This is the base class for the various configuration settings passed to the test-tunnel library's routines. For the present it is used by the functions in the test_tunnel.addresses module.

Source code in src/test_tunnel/defs.py
@dataclasses.dataclass(frozen=True)
class Config:
    """Common configuration for the tunnel testing library.

    This is the base class for the various configuration settings passed to
    the `test-tunnel` library's routines.
    For the present it is used by the functions in the `test_tunnel.addresses` module.
    """

    log: logging.Logger
    """The logger to send diagnostic and informational messages to."""

    offset: int
    """The number of ports to skip when looking for available ones."""

    verbose: bool
    """Has verbose logging been enabled?"""

log: logging.Logger instance-attribute

The logger to send diagnostic and informational messages to.

offset: int instance-attribute

The number of ports to skip when looking for available ones.

verbose: bool instance-attribute

Has verbose logging been enabled?

test_tunnel.defs.ConfigProg dataclass

Bases: Config

Common configuration also including a program to test in a UTF-8-capable environment.

This class extends the base Config class, adding the path to the program that will be tested (the tunnel proxy/server tool) and a set of variable/value pairs to pass to child processes to ensure their output may be parsed as UTF-8 strings.

Source code in src/test_tunnel/defs.py
@dataclasses.dataclass(frozen=True)
class ConfigProg(Config):
    """Common configuration also including a program to test in a UTF-8-capable environment.

    This class extends the base `Config` class, adding the path to the program that will
    be tested (the tunnel proxy/server tool) and a set of variable/value pairs to
    pass to child processes to ensure their output may be parsed as UTF-8 strings.
    """

    prog: pathlib.Path
    """The path to the program to test."""

    utf8_env: dict[str, str]
    """The UTF-8-capable environment settings."""

prog: pathlib.Path instance-attribute

The path to the program to test.

utf8_env: dict[str, str] instance-attribute

The UTF-8-capable environment settings.