pytest-attrib
The pytest-attrib plugin extends py.test with the ability to select tests based on a criteria rather than just the filename or pytest.marks. For example, you might want to run only tests that need internet connectivity, or tests that are slow.
The pytest.mark plugin already provides a featrure to mark tests and run only the marked tests. This plugin also allows to run expressions on the attributes of the class, and does not require the pytest.mark decorator.
It offers features similar to the nose plugin nose-attrib.
Installation
Install the plugin with:
pip install pytest-attrib
Usage examples
To use the plugin, the -a CLI argument has been provided. Consider a project with the test file:
import unittest
class MyTestCase(unittest.TestCase):
def test_function(self):
assert 1 == 1
class MySlowTestCase(unittest.TestCase):
slow = True
def test_slow_function(self):
import time
time.sleep(5)
assert 1 == 1
Using pytest-attrib, only the slow tests can be run using:
$ py.test -a slow
Or run only the fast tests using:
$ py.test -a "not slow"
The expression given in the -a argument can be even more complex, for example:
$ py.test -a "slow and requires_internet" $ py.test -a "slow and not requires_internet"
It can also do conditional arguments like:
$ py.test -a "speed=='slow' and requires_internet"
LICENSE
This code falls under the MIT License. Please note that some files or content may be copied from other places and have their own licenses. Dependencies that are being used to generate the databases also have their own licenses.
Metadata
Release files for pytest-attrib 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| pytest-attrib-0.1.3.tar.gz | 4.2 kB | Without provenance | Details for pytest-attrib-0.1.3.tar.gz |
Release files / pytest-attrib-0.1.3.tar.gz
| Download URL | pytest-attrib-0.1.3.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cf5e9cc35c5ba8f060b4413ae7491ba535b6b173f631ece40b007f53e153b7e4
|
|
BLAKE2b-256 checksum How to use checksums |
7386fa57c3f4b9d574eda056186c7915055e868c83823ca7a3103d8c38d5be11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pytest-attrib 0.1.3
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.