Skip to content

Reset usethis_config to defaults between tests in clear_functools_caches fixture#1829

Merged
nathanjmcdougall merged 4 commits into
mainfrom
copilot/update-clear-functools-caches-fixture
Apr 7, 2026
Merged

Reset usethis_config to defaults between tests in clear_functools_caches fixture#1829
nathanjmcdougall merged 4 commits into
mainfrom
copilot/update-clear-functools-caches-fixture

Conversation

Copilot AI commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

usethis_config.inferred_backend (and potentially other inferred values) persisted across tests, causing stale cached config to silently affect subsequent tests.

Changes

  • Config reset: Add usethis_config._restore(UsethisConfig()) to the clear_functools_caches autouse fixture, resetting all config fields to defaults before each test
  • _vary_network_conn scope change: Downgrade from scope="session" to function-scoped with an explicit dependency on clear_functools_caches to guarantee the config is reset before the offline flag is re-applied
  • Remove now-unnecessary teardown logic in _vary_network_conn since the config reset handles cleanup

Copilot AI and others added 2 commits April 6, 2026 20:08
Update the autouse fixture to reset the global usethis_config to
its defaults before each test, preventing stale inferred values
(like inferred_backend) from leaking between tests.

Also update _vary_network_conn to be function-scoped with an
explicit dependency on clear_functools_caches to ensure config
is reset before the offline flag is set.

Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/57778f3c-1cd5-4071-81e4-33024425a320

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
…ement

Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/57778f3c-1cd5-4071-81e4-33024425a320

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Copilot AI changed the title [WIP] Update clear_functools_caches fixture to reset inferred config values Reset usethis_config to defaults between tests in clear_functools_caches fixture Apr 6, 2026
Copilot AI requested a review from nathanjmcdougall April 6, 2026 20:11
@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review April 7, 2026 01:06
@codecov

codecov Bot commented Apr 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Apr 7, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing copilot/update-clear-functools-caches-fixture (44d3798) with main (6626b42)

Open in CodSpeed

@nathanjmcdougall nathanjmcdougall merged commit 28cafca into main Apr 7, 2026
20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/update-clear-functools-caches-fixture branch April 7, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants