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
Installation
You can install “pytest-helpers-namespace” via pip from PyPI:
$ pip install pytest-helpers-namespace
Usage
Consider the following conftest.py file:
pytest_plugins = ['helpers_namespace']
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
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
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 2016.4.3
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-2016.4.3.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_helpers_namespace-2016.4.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 11.6 kB
Release files / pytest-helpers-namespace-2016.4.3.tar.gz
| Download URL | pytest-helpers-namespace-2016.4.3.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d421541a77ee4ff3de268860cad0c497c1a31a12ff94ade0970b7454fce37316
|
|
BLAKE2b-256 checksum How to use checksums |
a116b6cdfc7421489e08cfe63b6eb7e6bac4e818f6bef851f4fdc36a67d26047
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pytest_helpers_namespace-2016.4.3-py2.py3-none-any.whl
| Download URL | pytest_helpers_namespace-2016.4.3-py2.py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
f71eff8f7a8233a49fc61bf71b10853e66d1095b038ca9d70b1bf6d9ce4ca419
|
|
BLAKE2b-256 checksum How to use checksums |
dc0b94c95ebd413a42f2cca9afdeb04c8ce40e7b8221a0b40442aff1c2c3967d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |