Skip to content

fix: PYAUTOFIT_TEST_MODE is a dead env var — aggregator test-mode fixture is a silent no-op #95

Description

@Jammy2211

Overview

The canonical test-mode knob is PYAUTO_TEST_MODE (read authoritatively in PyAutoNerves/autonerves/test_mode.py:14 via os.environ.get("PYAUTO_TEST_MODE", "0"), alongside PYAUTO_TEST_MODE_SAMPLES). Nothing anywhere reads PYAUTOFIT_TEST_MODE — verified by grep across every library and workspace repo.

test_autocti/aggregator/conftest.py uses the dead name in an autouse=True fixture, so the entire aggregator test module intends to run in test mode but never enters it.

Plan

  • Rename PYAUTOFIT_TEST_MODEPYAUTO_TEST_MODE in test_autocti/aggregator/conftest.py (the set_test_mode fixture).
  • Run the aggregator suite afterwards — enabling test mode for the first time may surface previously-masked behaviour (test mode namespaces output paths and can bypass sampling).
  • Companion docstring fix in PyAutoFit (separate PR, same task): autofit/non_linear/analysis/visualize.py Visualizer.should_visualize says "If PyAutoFit test mode is on" — naming the product rather than the variable is what leads readers to invent the wrong env var. Name PYAUTO_TEST_MODE explicitly.
Detailed implementation plan

Affected Repositories

  • PyAutoCTI (primary) — the real bug
  • PyAutoFit — one misleading docstring

Suggested branch: feature/testmode-env-drift

The bug

test_autocti/aggregator/conftest.py:13-17

@pytest.fixture(autouse=True)
def set_test_mode():
    os.environ["PYAUTOFIT_TEST_MODE"] = "1"   # <- nothing reads this
    yield
    del os.environ["PYAUTOFIT_TEST_MODE"]

Why it persisted

autocti_workspace_test/AGENTS.md:42 and autocti_assistant/skills/ac_fit_cti_model.md:126 already document that PYAUTOFIT_TEST_MODE does not exist. The trap was documented instead of deleted; this issue deletes it.

Out of scope (local-only, no PR)

Two gitignored .claude/settings.local.json allowlists (euclid_strong_lens_modeling_pipeline, autogalaxy_workspace) also use the dead name, meaning those allowlisted commands run without test mode. Fixed locally, not shipped.

Verification

  • pytest test_autocti/aggregator green with the corrected var.
  • Confirm the fixture actually takes effect (test mode active during those tests).

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