(python_dir)
| 255 | |
| 256 | |
| 257 | def test_unhealthy_then_replaced(python_dir): |
| 258 | prefix, tmpdir = python_dir |
| 259 | |
| 260 | python.install_environment(prefix, C.DEFAULT, ()) |
| 261 | |
| 262 | # simulate an exe which returns an old version |
| 263 | exe_name = win_exe('python') |
| 264 | py_exe = prefix.path(python.bin_dir('py_env-default'), exe_name) |
| 265 | os.rename(py_exe, f'{py_exe}.tmp') |
| 266 | |
| 267 | with open(py_exe, 'w') as f: |
| 268 | f.write('#!/usr/bin/env bash\necho 1.2.3\n') |
| 269 | make_executable(py_exe) |
| 270 | |
| 271 | # should be unhealthy due to version mismatch |
| 272 | ret = python.health_check(prefix, C.DEFAULT) |
| 273 | assert ret == ( |
| 274 | f'virtualenv python version did not match created version:\n' |
| 275 | f'- actual version: 1.2.3\n' |
| 276 | f'- expected version: {python._version_info(sys.executable)}\n' |
| 277 | ) |
| 278 | |
| 279 | # now put the exe back and it should be healthy again |
| 280 | os.replace(f'{py_exe}.tmp', py_exe) |
| 281 | |
| 282 | assert python.health_check(prefix, C.DEFAULT) is None |
| 283 | |
| 284 | |
| 285 | def test_language_versioned_python_hook(tmp_path): |
nothing calls this directly
no test coverage detected