Skip to main content

Pytest Helpers Namespace

See Build Status on Travis CI See Build Status on AppVeyor

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.


This Pytest plugin was generated with Cookiecutter along with @hackebrot’s Cookiecutter-pytest-plugin template.

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.

Metadata

Release files for pytest-helpers-namespace 2016.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-helpers-namespace 2016.4.2
File Size Uploaded
pytest-helpers-namespace-2016.4.2.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-helpers-namespace 2016.4.2
File Interpreter ABI Platform
pytest_helpers_namespace-2016.4.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 10.4 kB

Release files / pytest-helpers-namespace-2016.4.2.tar.gz

Download URL pytest-helpers-namespace-2016.4.2.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1904119db9599b10701e46836d983ef13f4f2d7d7463f467828e49f15f9d6dcb
BLAKE2b-256 checksum
How to use checksums
89cee44256f5166cefa79fd60fcbb4d6e3fc7553c3e0fe0f50ba8bf5a894f400
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pytest_helpers_namespace-2016.4.2-py2.py3-none-any.whl

Download URL pytest_helpers_namespace-2016.4.2-py2.py3-none-any.whl
Size 6.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d361dc03db70efc4e03bbf10c587501a42776c8ac418ff49e443a42ea331ecd9
BLAKE2b-256 checksum
How to use checksums
d8546a544af692eb8547efc861e2d42fc87d00952eb0446944e7d7fd1d97795f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
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