def test_py_info_cache_clear(mocker, tmp_path, session_app_data): spy = mocker.spy(cached_py_info, "_run_subprocess") assert PythonInfo.from_exe(sys.executable, session_app_data) is not None assert spy.call_count >= 2 # at least two, one for the venv, one more for the host PythonInfo.clear_cache(session_app_data) assert PythonInfo.from_exe(sys.executable, session_app_data) is not None assert spy.call_count >= 4
def ensure_py_info_cache_empty(): PythonInfo.clear_cache() yield PythonInfo.clear_cache()
def ensure_py_info_cache_empty(session_app_data): PythonInfo.clear_cache(session_app_data) yield PythonInfo.clear_cache(session_app_data)