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.
Contributing
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
License
Distributed under the terms of the Apache Software License 2.0 license, “pytest-helpers-namespace” is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Changelog
v2021.3.24
Switched project to a src layout.
Switched project to a declarative setuptools approach
Added support to check if a helper has been registered
v2019.1.8
Patch PyTest before any conftest.py file is processed.
v2019.1.7
Support PyTest >= 4.1
v2019.1.6.post1
No changes were made besides locking to PyTest < 4.0
v2019.1.6
No changes were made besides locking to PyTest < 4.1
v2017.11.11
Allow passing a string to the register function which will be the helper name
v2016.7.10
Allow a registered function to contibue to behave as a regular function. #4.
v2016.4.15
v2016.4.5
Use a wrapper class instead of adding an attribute to a function.
v2016.4.3
Provide proper errors when helper functions or namespaces are being overridden. #1
v2016.3.2
First working release
This Pytest plugin was generated with Cookiecutter along with @hackebrot’s Cookiecutter-pytest-plugin template.
Metadata
Release files for pytest-helpers-namespace 2021.3.24
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytest-helpers-namespace-2021.3.24.tar.gz | 29.2 kB | Without provenance | Details for pytest-helpers-namespace-2021.3.24.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_helpers_namespace-2021.3.24-py3-none-any.whl | Python 3 | none | any | Details for pytest_helpers_namespace-2021.3.24-py3-none-any.whl |
Total release size: 44.2 kB
Release files / pytest-helpers-namespace-2021.3.24.tar.gz
| Download URL | pytest-helpers-namespace-2021.3.24.tar.gz |
|---|---|
| Size | 29.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
188df5a7c52390fa27d6cd2f18e74d64a2ef0b9fb6e12f15fdf5a95f4813d25f
|
|
BLAKE2b-256 checksum How to use checksums |
17110a849086f190dc3a057e4d5dff07e50766c44cd495383729479db2420a4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.7
|
Release files / pytest_helpers_namespace-2021.3.24-py3-none-any.whl
| Download URL | pytest_helpers_namespace-2021.3.24-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a058de199517ba0088175e54311b37e657657fec333de05bdcdbed34dbbc8208
|
|
BLAKE2b-256 checksum How to use checksums |
6ed7fbd657fb7110089a67e493ce9bbf20e64efecff2abbc4e7dc936c33e0733
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.7
|
Security for pytest-helpers-namespace 2021.3.24
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.