1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
|
Metadata-Version: 2.1
Name: pytest-helpers-namespace
Version: 2021.4.29
Summary: Pytest Helpers Namespace Plugin
Home-page: https://github.com/saltstack/pytest-helpers-namespace
Author: Pedro Algarvio
Author-email: pedro@algarvio.me
License: Apache Software License 2.0
Project-URL: Source, https://github.com/saltstack/pytest-helpers-namespace
Project-URL: Tracker, https://github.com/saltstack/pytest-helpers-namespace/issues
Project-URL: Documentation, https://pytest-helpers-namespace.readthedocs.io
Description: .. image:: https://github.com/saltstack/pytest-helpers-namespace/actions/workflows/testing.yml/badge.svg
:target: https://github.com/saltstack/pytest-helpers-namespace/actions/workflows/testing.yml
:alt: See Build Status
.. image:: https://codecov.io/github/saltstack/pytest-helpers-namespace/coverage.svg?branch=master
:target: https://codecov.io/github/saltstack/pytest-helpers-namespace?branch=master
:alt: Code Coverage
.. image:: https://img.shields.io/pypi/v/pytest-helpers-namespace.svg?style=flat
:alt: PyPI Package latest release
:target: https://pypi.python.org/pypi/pytest-helpers-namespace
.. image:: https://img.shields.io/pypi/dm/pytest-helpers-namespace.svg?style=flat
:alt: PyPI Package monthly downloads
:target: https://pypi.python.org/pypi/pytest-helpers-namespace
.. image:: https://img.shields.io/pypi/wheel/pytest-helpers-namespace.svg?style=flat
:alt: PyPI Wheel
:target: https://pypi.python.org/pypi/pytest-helpers-namespace
.. image:: https://img.shields.io/pypi/pyversions/pytest-helpers-namespace.svg?style=flat
:alt: Supported versions
:target: https://pypi.python.org/pypi/pytest-helpers-namespace
.. image:: https://img.shields.io/pypi/implementation/pytest-helpers-namespace.svg?style=flat
:alt: Supported implementations
:target: https://pypi.python.org/pypi/pytest-helpers-namespace
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:
.. code-block:: python
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:
.. code-block:: python
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:
.. code-block:: python
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:
.. code-block:: python
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 `nox`_, 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
* Pytest >= 6.1.1 is now required
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
~~~~~~~~~~
* Hide the ``FuncWrapper`` traceback in pytest failures. `#3`_. Thanks Logan Glickfield(`@lsglick`_)
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.
.. _`Cookiecutter`: https://github.com/audreyr/cookiecutter
.. _`@hackebrot`: https://github.com/hackebrot
.. _`Apache Software License 2.0`: http://www.apache.org/licenses/LICENSE-2.0
.. _`cookiecutter-pytest-plugin`: https://github.com/pytest-dev/cookiecutter-pytest-plugin
.. _`file an issue`: https://github.com/saltstack/pytest-helpers-namespace/issues
.. _`pytest`: https://github.com/pytest-dev/pytest
.. _`nox`: https://nox.thea.codes/en/stable/
.. _`pip`: https://pypi.python.org/pypi/pip/
.. _`PyPI`: https://pypi.python.org/pypi
.. _`#1`: https://github.com/saltstack/pytest-helpers-namespace/issues/1
.. _`#3`: https://github.com/saltstack/pytest-helpers-namespace/pull/3
.. _`#4`: https://github.com/saltstack/pytest-helpers-namespace/issues/4
.. _`@lsglick`: https://github.com/lsglick
Platform: unix
Platform: linux
Platform: osx
Platform: cygwin
Platform: win32
Classifier: Programming Language :: Python
Classifier: Programming Language :: Cython
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Requires-Python: >=3.5
Provides-Extra: docs
Provides-Extra: lint
Provides-Extra: tests
|