fix(tests): the composition perf test scans its own tree, not pytest's shared temp root - #691
Merged
Merged
Conversation
…s shared temp root test_for_contract_perf_bound_shallow_path put the workspace directly in tmp_path. Its marker-less ancestor walk then took tmp_path's parents as scan roots: pytest's per-worker and per-session temp roots, which hold every contract written by every test that ran before it. The scan time therefore grew with the suite and failed the 10 s bound on main's Coverage & Audit run (10.50 s) after the 0.18.0 PRs added many contract-writing tests; locally the old placement takes 19 s. The workspace now sits _MAX_ANCESTOR_LEVELS below tmp_path, so the capped walk still crosses marker-less ancestors but ends at tmp_path, and the test asserts that. It runs in about 1 s; reverting the placement fails the new assertion.
📄 Documentation ReminderThis PR appears to be missing a documentation reference. Our docs live in a separate repo. Please update the PR description with one of:
See the Contributing Guide for details. |
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.
Why
test_for_contract_perf_bound_shallow_pathfailed the Coverage & Audit run on main after the 0.18.0 PRs merged. The composition scan took 10.50 s against a 10 s bound.The test placed its workspace directly in
tmp_path, which is a shallow path with no boundary marker. The ancestor walk therefore tooktmp_path's parents as scan roots. Those are pytest's per-worker and per-session temp roots, which hold every*.fluid.yamlwritten by every earlier test. The scan time grew with the suite, and #687, #688 and #689 added many contract-writing tests. The product code is unchanged: the scan parses withload_yaml_safeonly, andproduct_types.pywas not touched by those PRs.What
The workspace now sits
_MAX_ANCESTOR_LEVELSbelowtmp_path. The capped walk still crosses marker-less ancestors up to the cap, which is what the test is for, but it ends attmp_path. The test asserts this through_resolve_scan_roots.Tested
tests/test_composition_workspace_scan.py: 22 passed. The perf test takes about 1 s.ruffpasses, andblack==24.10.0 --checkpasses.Documentation