Skip to main content

Pytest plugin providing a parametrized fixture over the canonical BODS v0.4 fixtures pack

Project description

pytest-bods-fixtures

A pytest plugin that exposes the canonical bods-fixtures pack as a single auto-parametrized fixture, so adapter test suites can run their pipeline against every BODS v0.4 conformance case with one line of test code.

Why

If you write a tool that ingests, transforms, or emits Beneficial Ownership Data Standard statements, you want to know it handles the full shape of the standard — not just the happy path. The bods-fixtures pack provides that coverage (direct ownership, chains, circular ownership, joint control, declared-unknown UBOs, etc.). This plugin removes the parametrize boilerplate so you can drop the fixture into any test file and get one test per case.

Install

pip install pytest-bods-v04-fixtures

The bods-v04-fixtures data pack is pulled in as a dependency. The PyPI distribution is pytest-bods-v04-fixtures — the version-explicit name matches the data pack it parametrizes over and leaves the generic pytest-bods-fixtures name available for any future ecosystem-wide tooling. The pytest fixture name (bods_fixture) and Python import path (pytest_bods_fixtures) are unchanged.

Use

def test_my_adapter_does_not_raise(bods_fixture):
    MyAdapter().convert(bods_fixture.statements)

That's it. The test will run once per fixture in the pack. Failures show the fixture name in the test ID, so the offending case is obvious:

FAILED tests/test_adapter.py::test_my_adapter_does_not_raise[core/05-circular-ownership]

The bods_fixture parameter is a bods_fixtures.Fixture object exposing the same helper API the data pack ships:

def test_pipeline_emits_one_party_per_entity(bods_fixture):
    entities = bods_fixture.by_record_type("entity")
    persons = bods_fixture.by_record_type("person")
    output = MyAdapter().convert(bods_fixture.statements)
    assert len(output.parties) == len(entities) + len(persons)

Targeting specific cases

bods_fixture runs over every case. To target a subset, use pytest's standard -k selector:

pytest -k "circular-ownership"

Or write your own narrowly-scoped tests using bods_fixtures.load(name) directly:

from bods_fixtures import load

def test_anonymous_owner_is_not_silently_dropped():
    fixture = load("core/04-anonymous-interested-party")
    output = MyAdapter().convert(fixture.statements)
    # adapter-specific assertions about the FATF-relevant signal

Versioning

pytest-bods-v04-fixtures pins to a bods-v04-fixtures major version. Upgrading to a new minor of the data pack (which may add fixtures) just adds new test cases to your suite. Upgrading to a new major (which may change fixture shape) requires a new major of this plugin.

License

MIT — see LICENSE.

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

pytest_bods_v04_fixtures-0.1.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

pytest_bods_v04_fixtures-0.1.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file pytest_bods_v04_fixtures-0.1.1.tar.gz.

File metadata

  • Download URL: pytest_bods_v04_fixtures-0.1.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pytest_bods_v04_fixtures-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5a1a497b1ef5605ea7eeaf49a79b6e046c014f5edb95cf63e64c915a17c9d575
MD5 d8471ff7218d85032b9a5398dcfd15eb
BLAKE2b-256 a9b89ae1d4946e81fcd0fff33aa4dfd7d1e9f808ee239920ba41a650fc5dd3f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_bods_v04_fixtures-0.1.1.tar.gz:

Publisher: publish.yml on StephenAbbott/pytest-bods-fixtures

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_bods_v04_fixtures-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_bods_v04_fixtures-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d407de3080c03d27c6900cd6f6e2d7b9232d3ad4847ed15a2c2d408a19db9dc4
MD5 5d249b1a074e86e7e4c4182af95fb5a9
BLAKE2b-256 06b45023f0444ae7281f282e348336d4609138fc36f8afccb73c051c22c56ec7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_bods_v04_fixtures-0.1.1-py3-none-any.whl:

Publisher: publish.yml on StephenAbbott/pytest-bods-fixtures

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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