Pytest Helpers Namespace
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.
Features
Provides a helpers pytest namespace which can be used to register helper functions without requiring you to import them on your actual tests to use them.
Requirements
None!
Installation
You can install “pytest-helpers-namespace” via pip from PyPI:
$ pip install pytest-helpers-namespace
Usage
Consider the following conftest.py file:
import pytest
@pytest.helpers.register
def foo(bar):
"""
this dumb helper function will just return what you pass to it
"""
return bar
And now consider the following test case:
def test_helper_namespace():
assert pytest.helpers.foo(True) is True
Pretty simple right?!
You can even nest namespaces. Consider the following conftest.py file:
pytest_plugins = ["helpers_namespace"]
import pytest
@pytest.helpers.can.haz.register
def foo(bar):
"""
this dumb helper function will just return what you pass to it
"""
return bar
And now consider the following test case:
def test_helper_namespace():
assert pytest.helpers.can.haz.foo(True) is True
You 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.
Documentation
The full documentation can be seen here.
Metadata
Release files for pytest-helpers-namespace 2021.12.29
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest-helpers-namespace-2021.12.29.tar.gz | 53.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_helpers_namespace-2021.12.29-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 63.9 kB
Release files / pytest-helpers-namespace-2021.12.29.tar.gz
| Download URL | pytest-helpers-namespace-2021.12.29.tar.gz |
|---|---|
| Size | 53.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
792038247e0021beb966a7ea6e3a70ff5fcfba77eb72c6ec8fd6287af871c35b
|
|
BLAKE2b-256 checksum How to use checksums |
e8617f1a476b375c1238d152c164f7ffb694c662da8247816947be84b5fe2e8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/3.7.3 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.7
|
Release files / pytest_helpers_namespace-2021.12.29-py3-none-any.whl
| Download URL | pytest_helpers_namespace-2021.12.29-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d5c0262642998437a73d85cb6ae0db57d574facc551c4a4695e92ec50469eb98
|
|
BLAKE2b-256 checksum How to use checksums |
63a734844a563c425962658f093b359636deefd19eab6783896e0d378dae88a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/3.7.3 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.7
|