{"library":"pytest-datadir","title":"pytest-datadir","description":"pytest-datadir is a pytest plugin designed for easily managing test data directories and files within your test suite. It provides fixtures that automatically locate and copy test data, ensuring tests operate on isolated, temporary copies. The library is actively maintained, with version 1.8.0 being the latest, and receives frequent minor updates with occasional major releases.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install pytest-datadir"],"cli":null},"imports":["def test_something(datadir):","def test_something(shared_datadir):","def test_something(lazy_datadir):","def test_something(lazy_shared_datadir):"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"# File: data/hello.txt\nHello World!\n\n# File: test_hello/spam.txt\neggs\n\n# File: test_hello.py\nimport pytest\n\ndef test_read_global(shared_datadir):\n    # Accesses data from the global 'data' directory\n    contents = (shared_datadir / \"hello.txt\").read_text()\n    assert contents == \"Hello World!\\n\"\n\ndef test_read_module(datadir):\n    # Accesses data from the module-specific 'test_hello' directory\n    contents = (datadir / \"spam.txt\").read_text()\n    assert contents == \"eggs\\n\"\n","lang":"python","description":"To use `pytest-datadir`, organize your test data in a `data` directory (for global data) or subdirectories named after your test modules (e.g., `test_module/`) within your test folder. The `datadir` fixture provides access to module-specific data, while `shared_datadir` provides access to global data. Both return `pathlib.Path` objects pointing to temporary copies of your data.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"1.8.0","pypi_latest":"1.8.0","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":2.6,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pytest-datadir","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"30.7M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pytest-datadir","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":"31M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pytest-datadir","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"33.6M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pytest-datadir","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.6,"import_time_s":null,"mem_mb":null,"disk_size":"34M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pytest-datadir","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"25.2M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pytest-datadir","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.4,"import_time_s":null,"mem_mb":null,"disk_size":"26M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pytest-datadir","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"25.0M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pytest-datadir","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":"25M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pytest-datadir","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"30.0M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pytest-datadir","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":3,"import_time_s":null,"mem_mb":null,"disk_size":"31M"}]}}