Skip to content

The unguarded-pyarrow-import refusal is lost under pytest -n (xdist) #1305

Closed

Description

@jdatcmd

Found by OffgridwithJD, reviewing #1286 at 3941f05.

What happens: pgc_vacuity refuses a test file that imports pyarrow outside expect.require_module. The scan runs in pytest_collect_file, and under xdist that hook runs in the workers. config.pgc_capability_imports never reaches the controller, so the refusal is never printed.

pytest        -> REFUSED  test_bad.py imports pyarrow outside require_module (line 1)   rc=1
pytest -n 2   -> 2 passed                                                                rc=0

(Measured with a stub pyarrow and a test file holding import pyarrow.parquet as pq.)

Impact: low. CI runs the pytest jobs serially (ci.yml:268 has no -n), so the gate holds there. A developer running -n gets no refusal. Nothing passes vacuously either way: without pyarrow the file errors at import, and with pyarrow the test really runs.

Possible fixes:

  • Run the AST scan on the controller, over the collected paths.
  • Or ship the sites back as a report property, the way pgc_declined already travels.

Done when: a pytester arm runs with -n 2 and sees the REFUSED line and rc=1, and that arm goes red against the current hook.

🤖 Generated with Claude Code

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