pytest-datadir 1.6.1
pip install pytest-datadir
Released:
pytest plugin for test data directories and files
Navigation
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (MIT)
- Author: Gabriel Reis
- Tags pytest, test, unittest, directory, file
- Requires: Python >=3.8
-
Provides-Extra:
testing
,dev
Classifiers
- Development Status
- Intended Audience
- License
- Operating System
- Programming Language
- Topic
Project description
pytest-datadir
pytest plugin for manipulating test data directories and files.
Usage
pytest-datadir will look up for a directory with the name of your module or the global 'data' folder. Let's say you have a structure like this:
.
├── data/
│ └── hello.txt
├── test_hello/
│ └── spam.txt
└── test_hello.py
You can access the contents of these files using injected variables datadir
(for test_ folder) or shared_datadir
(for data folder):
def test_read_global(shared_datadir):
contents = (shared_datadir / "hello.txt").read_text()
assert contents == "Hello World!\n"
def test_read_module(datadir):
contents = (datadir / "spam.txt").read_text()
assert contents == "eggs\n"
pytest-datadir will copy the original file to a temporary folder, so changing the file contents won't change the original data file.
Both datadir
and shared_datadir
fixtures are pathlib.Path
objects.
License
MIT.
Project details
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (MIT)
- Author: Gabriel Reis
- Tags pytest, test, unittest, directory, file
- Requires: Python >=3.8
-
Provides-Extra:
testing
,dev
Classifiers
- Development Status
- Intended Audience
- License
- Operating System
- Programming Language
- Topic
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytest_datadir-1.6.1.tar.gz
.
File metadata
- Download URL: pytest_datadir-1.6.1.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d204cf93cfe62ddc37b19922df6c8c0f133c2899c224bd339b24920e84e7fd3 |
|
MD5 | 454415167daa5c9040a7ea474939bf90 |
|
BLAKE2b-256 | bb0e63301415b9233f0131339799d49ce0c0e8804d82f3f12615056a70e563c5 |
Provenance
The following attestation bundles were made for pytest_datadir-1.6.1.tar.gz
:
Publisher:
deploy.yml
on gabrielcnr/pytest-datadir
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pytest_datadir-1.6.1.tar.gz
- Subject digest:
4d204cf93cfe62ddc37b19922df6c8c0f133c2899c224bd339b24920e84e7fd3
- Sigstore transparency entry: 169666466
- Sigstore integration time:
- Permalink:
gabrielcnr/pytest-datadir@b68bea9a2f47f70a7101300424fbb4b2a1390ecb
- Branch / Tag:
refs/heads/release-1.6.1
- Owner: https://github.com/gabrielcnr
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
deploy.yml@b68bea9a2f47f70a7101300424fbb4b2a1390ecb
- Trigger Event:
workflow_dispatch
- Statement type:
File details
Details for the file pytest_datadir-1.6.1-py3-none-any.whl
.
File metadata
- Download URL: pytest_datadir-1.6.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa427f6218d3fc7481129d59c892bd7adfb8822613a2726ffc97f51968879cdb |
|
MD5 | b27dbd17d75e2990f90f5f84a604cca9 |
|
BLAKE2b-256 | 55f15e4d95ce96c03332726d7fd87b7b500f178994b638ca6a88b4ed3ca64438 |
Provenance
The following attestation bundles were made for pytest_datadir-1.6.1-py3-none-any.whl
:
Publisher:
deploy.yml
on gabrielcnr/pytest-datadir
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pytest_datadir-1.6.1-py3-none-any.whl
- Subject digest:
aa427f6218d3fc7481129d59c892bd7adfb8822613a2726ffc97f51968879cdb
- Sigstore transparency entry: 169666470
- Sigstore integration time:
- Permalink:
gabrielcnr/pytest-datadir@b68bea9a2f47f70a7101300424fbb4b2a1390ecb
- Branch / Tag:
refs/heads/release-1.6.1
- Owner: https://github.com/gabrielcnr
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
deploy.yml@b68bea9a2f47f70a7101300424fbb4b2a1390ecb
- Trigger Event:
workflow_dispatch
- Statement type: