11# ducktools-pythonfinder
22# MIT License
3- #
3+ #
44# Copyright (c) 2025 David C Ellis
5- #
5+ #
66# Permission is hereby granted, free of charge, to any person obtaining a copy
77# of this software and associated documentation files (the "Software"), to deal
88# in the Software without restriction, including without limitation the rights
99# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1010# copies of the Software, and to permit persons to whom the Software is
1111# furnished to do so, subject to the following conditions:
12- #
12+ #
1313# The above copyright notice and this permission notice shall be included in all
1414# copies or substantial portions of the Software.
15- #
15+ #
1616# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1717# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1818# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1919# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2020# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222# SOFTWARE.
23+ import sys
2324import os .path
2425from types import SimpleNamespace
2526from unittest .mock import patch
2829
2930from ducktools .pythonfinder .shared import DetailFinder , PythonInstall
3031
31- fake_python_path = "/path/to/python"
32- example_json = """
33- {
34- "version": [3, 13, 2, "final", 0],
35- "executable": "/path/to/python",
36- "architecture": "64bit",
37- "implementation": "cpython",
38- "metadata": {"freethreaded": false}
39- }
32+ fake_python_path = "/path/to/python" if sys . platform != "win32" else r"X:\path\to\python"
33+ example_json = f """
34+ {{
35+ "version": [3, 13, 2, "final", 0],
36+ "executable": "{ fake_python_path } ",
37+ "architecture": "64bit",
38+ "implementation": "cpython",
39+ "metadata": {{ "freethreaded": false} }
40+ }}
4041""" .strip ()
4142
4243example_install = PythonInstall (
@@ -160,7 +161,7 @@ def test_clear_invalid_runtimes(run_mock, stat_mock, temp_finder):
160161 with temp_finder , patch ("os.path.exists" ) as exists_patch :
161162 exists_patch .return_value = True
162163 temp_finder .clear_invalid_runtimes ()
163-
164+
164165 save_mock .assert_not_called ()
165166 assert os .path .abspath (fake_python_path ) in temp_finder .raw_cache
166167
@@ -224,4 +225,4 @@ def test_changed_stat_invalidates(run_mock, temp_finder):
224225 details = temp_finder .get_install_details (fake_python_path )
225226
226227 assert temp_finder .raw_cache [fake_abspath ]["mtime" ] == 1739886572
227- querymock .assert_called ()
228+ querymock .assert_called ()
0 commit comments