Skip to content

Python: a data file read by a pytest test selects nothing and does not fall back #255

Closed

Description

@FredApps

resolveByReference in src/repo/impact.ts passes isSourceFilePath as isCodeFile to resolveFileReferences. .py is not a source extension there, so a pytest test that reads a changed data file is treated as a transitive script reader (.py is in DIRECTING_EXTENSIONS). Nothing names a test file, so the chain ends, and a found transitive reader counts as "the suite cannot observe the file". The change selects nothing and does not fall back.

Repro: pyproject.toml with [tool.pytest.ini_options] testpaths = ["tests"], tests/data/prices.csv, and tests/test_prices.py reading Path(__file__).parent / "data" / "prices.csv". Change prices.csv.

Expected: tests/test_prices.py is selected, as test/f.test.js is for the same layout in a JavaScript repository.

Actual: no affected tests, fallbackRequired: false, analysis status SAFE_TO_PROPOSE. The same happens when a module under pkg/ reads the file and a test imports that module.

Related: #162 asks for a declared-inputs example for this layout. Declared inputs work around it, but without them the result is a silent skip rather than a fallback.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions