Skip to content

test: run the specification fixtures through the provider - #21

Merged
lourens-octopus merged 2 commits into
mainfrom
lourens/bmbb-1548/spec-tests
Nov 25, 2026
Merged

lourens-octopus merged 2 commits into
mainfrom
lourens/bmbb-1548/spec-tests

Conversation

@lourens-octopus

Copy link
Copy Markdown
Contributor

Resolves BMBB-1548.

What

Runs every case in the shared openfeature-provider-specification fixtures through the real provider and the OpenFeature SDK, inside the normal pytest run. All 71 cases pass. No evaluator or provider changes were needed.

  • Submodule at specification/, pinned to the spec repo's head (0f49852).
  • tests/specification_fixtures.py loads every case from specification/Fixtures/*.json and names each <fixture file> - <case description>. It raises during collection if no fixtures are found, so a missing submodule fails the whole run. targetingKey becomes the SDK's targeting key, and a null attribute is passed as present with a None value. run_fixture_case(case, evaluate) takes the evaluate step as a parameter, as ts's runSpecificationFixtures(evaluate) does. It asserts the value and the error code, and the reason only where the fixture states one.
  • tests/test_specification_fixtures.py serves each fixture's response from the fake feature flags server added in feat: fetch manifest on init and evaluate value #20 (with a ContentHash header), registers the provider with set_provider_and_wait, evaluates through an SDK client and shuts the SDK down afterwards. That covers the HTTP decode, the SDK's context merge and error handling, and the provider's boolean wiring.
  • CI: the test-python job checks out submodules.
  • Packaging: uv_build already leaves specification/ out of the sdist and the wheel. source-exclude makes that explicit.
  • CONTRIBUTING.md covers cloning with --recurse-submodules, updating the submodule, and fixing failures in the evaluator or provider rather than the runner.

Testing

  • uv run pytest, ruff check, ruff format --check, mypy and uv lock --check pass.
  • Changing two fixture expectations makes exactly those two cases fail. Removing the fixtures stops the run at collection.
  • Built the sdist and wheel and checked neither contains specification/.

🤖 Generated with Claude Code

@lourens-octopus
lourens-octopus requested a review from a team as a code owner November 23, 2026 20:26

@desruc desruc left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know Python very well, but I've scanned over everything and it looks fine. Claude assures me that it's ready to ship and closely matches what I did with the Go provider.

The tests are all passing, so I'm happy.

lourens-octopus and others added 2 commits November 25, 2026 01:44
Add the openfeature-provider-specification fixtures as a submodule at
specification/ and run every case through the real provider and the
OpenFeature SDK, against the fake feature flags server, inside the normal
pytest run. The run fails if no fixtures are found.

CI checks out submodules, the sdist explicitly excludes specification/, and
CONTRIBUTING.md covers cloning with submodules and updating them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Where a fixture expects an error but states no reason, the runner now
asserts the reason is ERROR, as the SDK passes a returned error through
unchanged. A malformed fixture file or case now fails collection with an
error naming the file and case, not a bare KeyError.

Move reset_the_sdk into conftest.py so the provider and fixture tests share
one copy, and stop the runner's evaluate step shadowing the test's case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lourens-octopus
lourens-octopus force-pushed the lourens/bmbb-1548/spec-tests branch from 8f667e8 to a271217 Compare November 25, 2026 01:45
@lourens-octopus
lourens-octopus merged commit 61540f8 into main Nov 25, 2026
17 checks passed
@lourens-octopus
lourens-octopus deleted the lourens/bmbb-1548/spec-tests branch November 25, 2026 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants