This plugin does not provide any helpers to pytest, it does, however, provide a helpers namespace in pytest which enables you to register helper functions in your conftest.py to be used within your tests without having to import them.
- Provides a
helperspytest namespace which can be used to register helper functions without requiring you to import them on your actual tests to use them.
- None!
You can install "pytest-helpers-namespace" via pip from PyPI:
$ pip install pytest-helpers-namespace
Consider the following conftest.py file:
importpytest@pytest.helpers.registerdeffoo(bar): """ this dumb helper function will just return what you pass to it """returnbarAnd now consider the following test case:
deftest_helper_namespace(): assertpytest.helpers.foo(True) isTruePretty simple right?!
You can even nest namespaces. Consider the following conftest.py file:
pytest_plugins= ["helpers_namespace"] importpytest@pytest.helpers.can.haz.registerdeffoo(bar): """ this dumb helper function will just return what you pass to it """returnbarAnd now consider the following test case:
deftest_helper_namespace(): assertpytest.helpers.can.haz.foo(True) isTrueYou can even pass a name to the register function and that will be the helper function name.
This Pytest plugin was generated with Cookiecutter along with @hackebrot's Cookiecutter-pytest-plugin template.
The full documentation can be seen here.