Add CI guard against pytest-local.ini drift and document its use for agents - #1159
Open
mborodii-prog wants to merge 1 commit into
Open
Add CI guard against pytest-local.ini drift and document its use for agents#1159mborodii-prog wants to merge 1 commit into
mborodii-prog wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close the coverage gap in the local/offline test config and guard it against drift
Closes #
Description
When developing locally, it would be ideal to have a smaller set of tests that do not require live KC tokens. Currently, Codex gets hung up running tests that require live access.
Desired Behavior
Streamlined smoke test set that allows local AI to test it's changes
Example current / desired from codex:
The apparent PY failures were not contract regressions—they were existing live-service recipe tests pulled in by a broad name filter, and the sandbox correctly could not contact Wrangles SSO. I'm narrowing the run to the changed offline contract paths, then I'll separate that evidence from any live-service coverage in the handoff.
What was actually wrong
The credential-free selection this issue asks for already existed (
pytest-local.ini+scripts/test-local.ps1), and running it does solve the problem: 1566 passed, 0 credential-related failures, only two known timing-sensitive tests flaky under load. So the capability wasn't missing.Two real gaps were:
tests/**/test_*.pyfiles existed on disk but were reachable by neithertestpathsnor an explicit--ignore, so they were silently skipped by every local run with no signal that anything was missing:test_akeneo.py,test_http.py,test_s3.py,test_train.py, test_sftp.py, top-leveltest_wrangles.py, and the mixedtest_back_ processes.py`.AGENTS.md— the file Codex reads automatically every session — said nothing about testing at all. A fresh agent had no way to discoverpytest-local.iniand would default to barepytest, hitting exactly the live-SSO failures quoted above.Changes
pytest-local.iniClassified every previously-uncovered file:
testpaths(offline-safe):test_akeneo.py(self-skips via its existing_skip_no_credsmarker when no credentials are set),test_sftp.py(no tests to run yet).--ignore(needs live credentials/services, no mocking):test_http.py(real HTTP + OAuth againstsso.wrangle.works),test_s3.py(real AWS),test_train.py(real model training/classify calls), top-leveltest_wrangles.py(real classify/extract calls).test_back_ processes.py(mixed file) added totestpaths, with its 3 credential-dependent tests individually--deselected(
test_user_config_credentials,test_refresh_token_error, test_refresh_token`), keeping its 2 offline-safe mocked auth tests running.testpathsoption, likeaddopts, is shlex-split. The unquotedtests/test_back_ processes.pyentry was silently splitting into two nonexistent paths (tests/test_back_andprocesses.py), so that file wasn't actually being collected at all despite looking correct in the raw ini. Fixed by quoting it.scripts/check_pytest_local_config.py(new)Validates
pytest-local.iniagainst a full, unrestricted test collection:testpathsentry resolves to a real path on disk (catches the shlex-splitting bug above, and any future instance of it).--ignore=/--deselect=entry still matches a real, currently collected test (catches stale entries left by a rename/delete).tests/**/test_*.pyfile is covered bytestpathsor explicitly--ignored (catches a newly added file being silently excluded).Verified it passes clean against the current config, and correctly fails with clear message when a stale ignore, stale deselect, uncovered new file, or unquoted-space
testpathsentry is injected..github/workflows/ci.ymlNew
pytest-local-configjob runs the check above on every push/PR, so a forgotten update topytest-local.inifails CI instead of rotting silently.AGENTS.mdNew "Running tests locally" section instructing agents to use
pytest -c pytest-local.ini/scripts/test-local.ps1instead of barepytest, explaining why (live SSO/AWS/AI credentials aren't available in sandbox), how to report a live-service-only failure honestly instead of as a regression, and how to fixpytest-local.inithemselves via the new drift-check when they add a test file.Tests
scripts/test-local.ps1against the corrected config: 1566 passed, 9 skipped, 2 failed (test_timeout_time,TestBatch::test_batch_threads— both timing-sensitive; reproduced in isolation immediately after and both passed in 8.37s, confirming system-load flakiness, not a regression from this change).scripts/check_pytest_local_config.pyrun directly: passes clean.--ignore, a stale--deselect, a new uncovered test file, and an unquoted-spacetestpathsentry.