pytest-toolbox
Copyright (C) 2016 Samuel Colvin
Numerous useful plugins for pytest.
Fixtures
- tmpworkdir
Run the test with the working directory set to a temporary directory. Similar to the pytest plugin tmpdir except working directory is changed.
- smart_caplog
capture logs with a smarter interface than pytest’s native caplog
- print_logs
print all logs.
- loop
asyncio loop.
Methods
(See below for usage examples).
- mktree
Create a tree of files from a dictionary.
- gettree
Return a dictionary depicting a directory tree.
Comparison Objects
All can be imported from pytest_toolbox.comparison.
- CloseToNow
check that a date (or date-like object) is close to now
- AnyInt
check tests that an object is an int
- RegexStr
check that a string matches the regex
- IsUUID
that that an object is an instance of UUID.
Used with equals as in my_date == CloseToNow(), these are useful when checking objects which contain a few unknown values are as expected
Eg.
assert {
'details': {
'user': 'foobar@example.com',
'id': AnyInt(),
'published': False,
'event': 'an example',
'created_ts': CloseToNow(),
},
'other_thing': [
...
],
...
} == obj
Usage
from pytest_toolbox import gettree, mktree
def test_whatever(tmpworkdir):
mktree(tmpworkdir, {
'foobar.txt': 'has this content'
})
assert gettree(tmpworkdir) = {'foobar.txt': 'has this content'}
TODO
Metadata
Release files for pytest-toolbox 0.4
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-toolbox-0.4.tar.gz | 5.5 kB | Without provenance | Details for pytest-toolbox-0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_toolbox-0.4-py35+-none-any.whl | Details for pytest_toolbox-0.4-py35+-none-any.whl |
Total release size: 11.7 kB
Release files / pytest-toolbox-0.4.tar.gz
| Download URL | pytest-toolbox-0.4.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e23243aabd20dfb4e6ca7c1b18bcda3951119c7827898a535ef84d3e2915a673
|
|
BLAKE2b-256 checksum How to use checksums |
7563ffc87832881f6d0c5899140a4e3d379f5f464f6185ac48c21a2f48662c11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pytest_toolbox-0.4-py35+-none-any.whl
| Download URL | pytest_toolbox-0.4-py35+-none-any.whl |
|---|---|
| Size | 6.2 kB |
|
SHA-256 checksum How to use checksums |
31db0ee5492e0878ece2a98687209cbd96952317c7e1b2a2423342db4a2db103
|
|
BLAKE2b-256 checksum How to use checksums |
c7011d183f6d5c9156da1a82e9d61f93eb8ecb3a7e388b0747e5db4d71e5109e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pytest-toolbox 0.4
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.