Skip to main content
See Build Status on Travis CI See Build Status on AppVeyor Code Coverage PyPI Package latest release PyPI Package monthly downloads PyPI Wheel Supported versions Supported implementations

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:

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.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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-helpers-namespace-2016.4.5.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_helpers_namespace-2016.4.5-py2.py3-none-any.whl (7.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pytest-helpers-namespace-2016.4.5.tar.gz.

File metadata

File hashes

Hashes for pytest-helpers-namespace-2016.4.5.tar.gz
Algorithm Hash digest
SHA256 0cf30fcb19e5ff93c8915aaf4671ece4d67f232a164d4dd2e41a1deeb3018694
MD5 3baf86e6afe941679f3a6ed7afeeb3ca
BLAKE2b-256 c0758bdae86fa9e754bb80314882ca9323881b50f08a657a8a0bf7fffabc99b6

See more details on using hashes here.

File details

Details for the file pytest_helpers_namespace-2016.4.5-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_helpers_namespace-2016.4.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1ca69ab3977bafe9b47ba8c6e1dbd5ffcf6edb8786da88feecb337bd68fdbcf1
MD5 9f69fe0476bc823344fe0e599ab781c6
BLAKE2b-256 0b60bfcd762e461b102c2343a1802bc3a73b49c7bcbed150b7bbbd63cac20eea

See more details on using hashes here.

Release history Release notifications | RSS feed

2021.12.29

2 files

2021.4.29

2 files

2021.3.24

2 files

2019.1.8

2 files

2019.1.7

2 files

2019.1.6

2 files

2017.11.11

2 files

2016.7.10

2 files

2016.4.15

2 files

This release

2016.4.5 This release

2 files

2016.4.3

2 files

2016.4.2

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page