libb.patch_load

patch_load(module_name, funcs, releft='', reright='', repl='_', module_name_prefix='')[source]

Patch and load a module with regex substitutions.

Useful for replacing function names with test prefixes.

Parameters:
  • module_name (str) – Name of the module to load.

  • funcs (list) – List of function names to patch.

  • releft (str) – Left side of regex pattern.

  • reright (str) – Right side of regex pattern.

  • repl (str) – Replacement prefix (default: ‘_’).

  • module_name_prefix (str) – Prefix for the module name.

Returns:

The patched module.

Return type:

ModuleType

Usage:

mod = patch_load(<module_name>, <funcs>)
mod.<func_name>(<*params>)