pytest_helpers_namespace package

Submodules

pytest_helpers_namespace.plugin module

Pytest Helpers Namespace Plugin.

class pytest_helpers_namespace.plugin.FuncWrapper(func: pytest_helpers_namespace.plugin.F)[source]

Bases: object

Wrapper class for helper functions and namespaces.

static register(func: pytest_helpers_namespace.plugin.F) pytest_helpers_namespace.plugin.F[source]

Register a helper function.

This function will just raise a RuntimeError in case a function registration, which also sets a nested namespace, tries to override a known helper function with that nested namespace. This will just make the raised error make more sense.

Instead of “AttributeError: ‘function’ object has no attribute ‘register’”, we will raise the exception below.

__call__(*args: Any, **kwargs: Any) Any[source]

This wrapper will just call the actual helper function.

class pytest_helpers_namespace.plugin.HelpersRegistry[source]

Bases: object

Helper functions registrar which supports namespaces.

register(func: Union[pytest_helpers_namespace.plugin.F, str], name: Optional[str] = None) pytest_helpers_namespace.plugin.F[source]

Register’s a new function as a helper.

__getattribute__(name: str) Any[source]

Return an attribute from the registry or register a new namespace.

__repr__() str[source]

Return a string representation of the class.

__call__(*_: Any, **__: Any) Any[source]

Show a warning when calling an unregistered helper function.

__contains__(key: str) bool[source]

Check for the presence of a helper name in the registry.

pytest_helpers_namespace.plugin.pytest_load_initial_conftests(*_: Any) None[source]

Hook into pytest to inject our custom helpers registry.

pytest_helpers_namespace.plugin.pytest_sessionstart(session: Session) None[source]

Register our plugin with pytest.

pytest_helpers_namespace.plugin.pytest_unconfigure() None[source]

Delete our custom helpers registry from the pytest module namespace.

pytest_helpers_namespace.version module