$npx skillfedfor your agent

pytest-datafiles

py.test plugin to create a 'tmp_path' containing predefined files/directories.

Worth itPyPI TestingReleased Jan 2026123.9K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pytest_datafiles-3.0.1-py3-none-any.whl
v3.0.1 · released 2026-01-04 · Python >=3.8 · 1 runtime deps: pytest

Yes. This is a stable, low-friction plugin (pure Python, only pytest dependency) with active maintenance and no known vulnerabilities. It solves a common testing problem—data isolation—cleanly and has been proven in production since 2015. Install it if your tests work with files and you want to avoid fixture pollution or manual cleanup.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low friction: pure Python wheel with only pytest as a runtime dependency.
  • Actively maintained since 2015 with recent updates; the maintainer notes little activity because the plugin is stable and works as intended.

License · maintenance · safety

MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal obligations.

last release 2026-01-04 (222 days) · last repo commit 2026-08-06 · 106 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 123,874 downloads/mo, #11,893 on PyPI

Verify before relying

pip install pytest-datafiles

import pytest
from pathlib import Path

@pytest.mark.datafiles('/path/to/file.txt')
def test_example(datafiles):
    # datafiles is a pathlib.Path object pointing to the temp directory
    assert (datafiles / 'file.txt').exists()
  • Whether the plugin works with pytest plugins that also manipulate tmp_path or fixture scoping
  • Performance characteristics when copying very large file trees or many files per test
Same gist for agents: .md · .json

What it is and what it does

pytest-datafiles is a pytest plugin that automates the setup of test data by copying files and directories into a temporary directory before each test runs. You decorate a test function with @pytest.mark.datafiles() and list the files or directories you want copied, then receive a pathlib.Path object pointing to the temporary copy. This keeps your original test data untouched across test runs and ensures each test works on its own isolated copy.

The plugin is useful when tests need to read or modify files without side effects—common scenarios include testing on large media files, image processing, or any workflow where you want to verify file handling without corrupting your test fixtures. It supports both string paths and pathlib.Path objects, offers options to control directory nesting and duplicate file handling, and integrates seamlessly into pytest's fixture and marker system.

Use it for

  • Testing video or image processing code on large files stored outside the test suite without modifying originals
  • Running multiple tests on the same fixture files while ensuring each test gets an independent copy
  • Verifying file I/O and modification logic in isolation, with automatic cleanup after each test
  • Setting up complex directory structures for integration tests that need realistic file layouts
  • Testing file-based tools or utilities where you need to confirm they don't corrupt the input data

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

This is a stable, low-friction plugin (pure Python, only pytest dependency) with active maintenance and no known vulnerabilities. It solves a common testing problem—data isolation—cleanly and has been proven in production since 2015. Install it if your tests work with files and you want to avoid fixture pollution or manual cleanup.

Install

pytest-datafiles on PyPI

Before you install

Low friction: pure Python wheel with only pytest as a runtime dependency. Actively maintained since 2015 with recent updates; the maintainer notes little activity because the plugin is stable and works as intended.

License in practice

MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal obligations.

Quickstart

pip install pytest-datafiles

import pytest
from pathlib import Path

@pytest.mark.datafiles('/path/to/file.txt')
def test_example(datafiles):
    # datafiles is a pathlib.Path object pointing to the temp directory
    assert (datafiles / 'file.txt').exists()

Verify before relying

  • Whether the plugin works with pytest plugins that also manipulate tmp_path or fixture scoping
  • Performance characteristics when copying very large file trees or many files per test

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.8
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
pytest
MaintenanceActively maintained 222 days since the last release
Last repo commit
First released
Downloads123,874 / month, #11,893 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Testing

Evidence: pytest_datafiles-3.0.1-py3-none-any.whl

Tags

Capabilities
pytest fixture for test data filescopy files to temp directory pytesttest file isolation pytestpytest datafiles plugintemporary test data setuppytest tmp_path fixture helpertest data management pytest
Topics
pytest-plugintest-fixturesfile-isolation
PyPI keywords
datafilespytesttmp_path

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “pytest fixture for test data files”

  • pytest-datafilesA pytest plugin that copies specified files and directories into a…
  • pytest-datadirA pytest plugin that provides fixtures for safely accessing test data…
  • pytest-casespytest-cases lets you separate test case data from test code in…

Give your agent the search over MCP, or paste the wish link into any chat.

More Testing packages

pluggy Worth it
PyPI · Libraries · released May 2025

Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.

Install it if you're building an extensible application or framework.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
pytest Worth it
PyPI · Libraries · released Jun 2026

pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.

MITpure Python · 3.10+
1.1Bdownloads / mo
virtualenv Worth it
PyPI · Libraries · released Aug 2026

virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.

MITpure Python · 3.9+
532.9Mdownloads / mo
coverage Worth it
PyPI · Testing · released Aug 2026

Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.

Install it if you want to measure test completeness or enforce coverage thresholds in your project.

permissive licensepure Python · 3.10+
335.8Mdownloads / mo
pytest-asyncio Worth it
PyPI · Testing · released May 2026

pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.

Install it if you write tests for any asyncio-based code.

Apache-2.0pure Python · 3.10+
275.9Mdownloads / mo
pytest-json-ctrf Worth it
PyPI · Testing · released Jul 2026

A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.

Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.

MITpure Python · 3.8+
273.0Mdownloads / mo

See also pytest-helpers-namespace · pytest-regressions · pytest-datadir · pytest-xprocess · pytest-pythonpath · deadline-cloud-test-fixtures · pytest-cases · pytest-freezegun · pytest-logging