- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.1k
 
Open
Labels
Description
I'm bulding the latest version 20.33.0 as an RPM package in Fedora Linux with Python 3.14 and the test mentioned in the subject fails with:
    def test_py_info_cache_invalidation_on_py_info_change(mocker, session_app_data):
        # 1. Get a PythonInfo object for the current executable, this will cache it.
        PythonInfo.from_exe(sys.executable, session_app_data)
    
        # 2. Spy on _run_subprocess
        spy = mocker.spy(cached_py_info, "_run_subprocess")
    
        # 3. Modify the content of py_info.py
        py_info_script = Path(cached_py_info.__file__).parent / "py_info.py"
        original_content = py_info_script.read_text(encoding="utf-8")
        try:
            # 4. Clear the in-memory cache
            mocker.patch.dict(cached_py_info._CACHE, {}, clear=True)  # noqa: SLF001
            py_info_script.write_text(original_content + "\n# a comment", encoding="utf-8")
    
            # 5. Get the PythonInfo object again
            info = PythonInfo.from_exe(sys.executable, session_app_data)
            # 6. Assert that _run_subprocess was called again
            if is_macos_brew(info):
                assert spy.call_count in {2, 3}
            else:
>               assert spy.call_count == 2
E               assert 1 == 2
E                +  where 1 = <function _run_subprocess at 0x7fd7655e5d20>.call_count
I've debugged it, and it seems that the spy.call_count is increased only once (0 → 1) in step 5.
I don't understand why the spy.call_count should be 2 when the spy is created after step one, which should mean that the first call to _run_subprocess in step one is not recorded by the mocker.