mete0r.testfixture
a testfixture helper
Quickstart
To install:
pip install mete0r.testfixture
Let’s assume your project has following structure:
yourproject/
setup.py
yourpackage/
__init__.py
tests/
__init__.py
test_foo.py
fixtures/
foo.py
bar.py
Define a fixture in yourpackage/tests/fixtures/foo.py:
from mete0r_testfixture.testfixture import testfixture
@testfixture('Foo')
def foo(fixtures):
return {
'foo': None,
}
Define another fixture in yourpackage/tests/fixtures/bar.py:
@testfixture('Bar', 'foo')
def bar(fixtures):
return {
'bar': fixtures.get('Foo')
}
Now you can use them in your tests:
# yourpackage/tests/test_foo.py
from unittest import TestCase
from mete0r_testfixture.testfixture import TestFixtures
from . import fixtures
class FooTest(TestCase):
def test_foo(self):
testfixtures = TestFixtures('yourpackage.tests.fixtures')
self.assertEquals({
'bar': {
'foo': None,
},
}, testfixtures.get('Bar', 'foo')
You can also list test fixtures defined in your packages:
$ mete0r-testfixture-scan yourpackage Foo yourpackage.tests.fixtures.foo.foo Bar, foo yourpackage.tests.fixtures.bar.bar
Caveat
mete0r.testfixture uses venusian to scan fixtures, so be careful not to scan test fixtures in your main application/package. For example:
config = Configurator(...) # pyramid configurator ... config.scan(ignore=[b'yourpackage.tests'])
Development environment
To setup development environment:
python setup.py virtualenv make
Changes
0.0.2 (2017-04-08)
Scans modules in the added order.
0.0.1 (2017-04-08)
Changes usage.
0.0.0 (2017-01-27)
Initial release.
Metadata
Release files for mete0r.testfixture 0.0.2
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 |
|---|---|---|---|---|
| mete0r.testfixture-0.0.2.tar.gz | 77.8 kB | Without provenance | Details for mete0r.testfixture-0.0.2.tar.gz |
Release files / mete0r.testfixture-0.0.2.tar.gz
| Download URL | mete0r.testfixture-0.0.2.tar.gz |
|---|---|
| Size | 77.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2601fd4f7d26e1584752dee738c553da723ec018de32f873a3aa53e59605984b
|
|
BLAKE2b-256 checksum How to use checksums |
3d1ec51c7a42b0a187af22d6144ccf0ddf5bdef6037403cdf81528d83441b110
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for mete0r.testfixture 0.0.2
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.