mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 02:54:26 +00:00
test_sso.py, test_sso_oidc_plugin.py and test_sso_proxy_consumers.py evict utils, utils.cache, utils.cache.applications and the roles packages from sys.modules to import their plugin against fresh modules, and never put the originals back. Ansible's plugin loader keeps the applications lookup it loaded earlier in sys.modules, so that lookup stayed bound to the evicted utils.cache.applications, whose _MERGED_APPLICATIONS_CACHE utils.cache._reset_cache_for_tests() no longer reaches. On main this turned test_webserver_worker_limits red whenever one xdist worker ran a test that loads the applications lookup through Ansible, then one of these sso tests, then the worker-limits test: the stale cache served the cpus 0.5 payload of test_a_sub_cpu_proxy_still_runs_one_worker, so the later methods rendered worker_processes 1 instead of 4 (main run 41139196554, Workspace centos and fedora, second make test on gw1). _load_module now runs inside mock.patch.dict(sys.modules): the plugin keeps the fresh modules it was built against, and sys.modules returns to its prior state afterwards. This is the change store-i18n carries sinceec0fde6561, ported unchanged so both lines stay identical. Evidence: - Before: pytest -n 0 test_tor_ports.py test_sso_oidc_plugin.py test_webserver_worker_limits.py -> "3 failed, 33 passed", the CI failure set ('1' != '4' twice, worker_processes 1 vs 4). - After: test_tor_ports.py, the four sso test files and test_webserver_worker_limits.py -> "68 passed". (cherry picked from commitec0fde6561) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>