Skip to main content

Pytest plugin that allows you to easily define data-driven fixtures based on external files.

Project description

Pytest Fingest Fixture Plugin

This Pytest plugin allows you to easily define data-driven fixtures based on external files. It supports JSON, CSV, and XML data sources, and can automatically instantiate Python classes or functions using this data.

Features

  • Automatic registration of data-backed fixtures
  • Supports JSON, CSV, and XML file formats
  • Optional descriptions for improved debugging
  • Configurable base data path via pytest.ini

Installation

Place the plugin code inside your project (e.g. in conftest.py) or install it as a standalone plugin.


Configuration

Add the following to your pytest.ini:

[pytest]
fingest_fixture_path = data  # Base directory for fixture data files

Example Conftest

from fingest.plugin import data_fixture
from fingest.types import BaseFixture, JSONFixture


@data_fixture("test.json", description="JSON File Foo Bar")
class JsonData(JSONFixture): ...


@data_fixture("test.xml", description="XML File Foo Bar")
class XMLData(BaseFixture): ...


@data_fixture("test.csv", description="CSV File FOO Bar")
class CSV(BaseFixture):
    """CSV File"""

    ...


@data_fixture("test.json", description="Func Bases")
def json_test_file(data):
    """Json File in func"""
    return data

Example Test

def test_data_fixture(JsonData):
    assert JsonData.data.get("Foo") == "Bar"


def test_data_fixtute(JsonData):
    assert JsonData.length() == 1


def test_xml(XMLData):
    assert XMLData


def test_csv(CSV):
    assert len(CSV.data) == 5


def test_json_func(json_test_file):
    assert json_test_file.get("Foo") == "Bar"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fingest-0.0.3.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fingest-0.0.3-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file fingest-0.0.3.tar.gz.

File metadata

  • Download URL: fingest-0.0.3.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Linux/6.12.33+deb13-amd64

File hashes

Hashes for fingest-0.0.3.tar.gz
Algorithm Hash digest
SHA256 355b00283c60d6df735ff35e2b73c0f77923b70c41dd3a5db15e9c1857fccb72
MD5 5b8e4bdd7e941d2f9a149e704832701f
BLAKE2b-256 e8b72f7c162e5d8642b15b0fb07a945b9a8160f9865e35b3b10a44f0204bd41b

See more details on using hashes here.

File details

Details for the file fingest-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: fingest-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Linux/6.12.33+deb13-amd64

File hashes

Hashes for fingest-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a53c78d4094014526717a41ca9b96e27beb766fffc19828d18d17fc6de030fec
MD5 e6b56d4b41e606bab62c3dbd51b0980c
BLAKE2b-256 55de5cb9dd0a24fd34b7c46ff0eacd521933e7877a22abf6e63ef3fd6605e393

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page