Overview
A pytest plugin to provide fixtures to load test data from files automatically.
Usage
Fixtures
This plugin provides following fixtures for each test modules.
test_data_info
test_data_info provides a namedtuple object, data_from_files.ModuleInfo, has the following values for each test modules.
root: test root dir, <package_dir>/tests/ by default and is configurable with –test-root (test_root) option.
datadir: test data dir using the fixture will be searched under <root>/<test_data_dirname>/, where test_data_dirname is configurable with –test-data-dirname option.
if the test code using the fixture is tests/test_foo.py, then datadir becomes tests/data/foo/
if the test code using the fixture is tests/foo/bar/test_baz.py, then datadir becomes tests/data/foo/bar/baz
subdirs: names of sub dirs relative to datadir if such dirs exist.
test_data
test_data provides a list of or a list of lists of namedtuple objects, data_from_files.DataInfo, has the following values.
data: data loaded from a file <path> under <datadir>
path: a file path contains the data
datadir: dir contains the test data file
Options
–test-root: test root dir where test data are seached [<package_dir>/tests]
–test-data-dirname: test data dir name [data]
–test-data-pattern: test data file path pattern relative to datadir [**/*.*]
Examples
tests/test_plugin.py and test data under tests/data/plugin/
tests/test_plugin_no_data.py and test data under tests/data/plugin_no_data
tests/foo/test_bar.py and test data under tests/data/foo/bar
Installation
Requirements
How to install
PyPI:
pip install pytest_data_from_files
From git repo:
pip install git+https://github.com/ssato/pytest-data-from-files
Build wheel and install it:
tox -e dists && pip install dist/pytest_data_from_files-*.whl
Metadata
Release files for pytest-data-from-files 0.2.0
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-data-from-files-0.2.0.tar.gz | 15.8 kB | Without provenance | Details for pytest-data-from-files-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_data_from_files-0.2.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for pytest_data_from_files-0.2.0-py2.py3-none-any.whl |
Total release size: 24.7 kB
Release files / pytest-data-from-files-0.2.0.tar.gz
| Download URL | pytest-data-from-files-0.2.0.tar.gz |
|---|---|
| Size | 15.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0efa8648914c415ce094c12418767a0e080712647c535bbdda63dcd6935f872
|
|
BLAKE2b-256 checksum How to use checksums |
e1426597d0f3abadf2e936c24723150868990af71bbff792a2f0a5897285cc7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.7
|
Release files / pytest_data_from_files-0.2.0-py2.py3-none-any.whl
| Download URL | pytest_data_from_files-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
3115600e2f81619b8b7619b8ef9a0a17e83a5afb3f5a6fef8d8f9b41d01b4ce4
|
|
BLAKE2b-256 checksum How to use checksums |
90cf87655dc68fdbe0dc996f2075e012b9a2b68e3f4a85ecbcf636da4e5c53ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.7
|
Security for pytest-data-from-files 0.2.0
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.