Skip to content

python: a test that parametrizes an argument directly is credited to the fixture of that name #1529

Closed

Description

@swapnilpaliwal-sd

Symptom

A test that parametrizes an argument directly is credited to the fixture of the same name, although pytest never runs that fixture for it.

Reproduction

shop/users.py line 1 is def load_user(name):. tests/conftest.py declares @pytest.fixture def user(): return load_user("default").

# tests/test_users.py
 1  import pytest
 2
 3
 4  @pytest.mark.parametrize("user", [{"name": "direct"}])
 5  def test_direct(user):
 6      assert user["name"] == "direct"
 7
 8
 9  @pytest.mark.parametrize("user", ["other"], indirect=True)
10  def test_indirect(user):
11      assert user["name"] == "default"
12
13
14  def test_plain(user):
15      assert user["name"] == "default"
$ axiomcode impact load_user --tests
    [fixture] 3 test(s) in 1 file(s):
      tests/test_users.py (3) via user: test_users.py::test_direct, test_users.py::test_indirect, test_users.py::test_plain

With load_user changed to raise, pytest reports test_indirect and test_plain as errors and test_direct as passed. test_indirect and test_plain are the control and are right. The engine's fixture_injection edge test_direct -> user is emitted too. MCP axiomcode_impact tests=true prints the same. Measured on 0.1.3 at 0df257c.

Root cause

plugins/axiomcode/skills/axiomcode/scripts/axiomcode-impact:1043-1049 records every parameter name as takes_param, and dl/impact.dl:823-826 joins it to a fixture by name without looking at the test's parametrize decoration. The engine does the same in graph/python/engine/framework-behavior/dispatch.dl:226-229.

Expected: an argument named in a direct (not indirect) @pytest.mark.parametrize of the test does not bind the fixture of that name.

Activity

  1. swapnilpaliwal-sd commented on Sep 28, 2026

    @swapnilpaliwal-sd
    ContributorAuthor

    Fixed by #1631.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpythonPythonskillAgent-facing query skill (skills/axiomcode)

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions