MCPcopy
hub / github.com/pex-tool/pex / test_resolve_current_platform

Function test_resolve_current_platform

tests/test_resolver.py:351–379  ·  view source on GitHub ↗
(p537_resolve_cache)

Source from the content-addressed store, hash-verified

349 PY_VER < (3, 5) or IS_PYPY, reason="The p537 distribution only builds for CPython 3.5+"
350)
351def test_resolve_current_platform(p537_resolve_cache):
352 # type: (str) -> None
353 def resolve_current(interpreters=()):
354 # type: (Iterable[PythonInterpreter]) -> List[str]
355
356 # N.B.: None stands in for the "current" platform at higher layers that parse platform
357 # strings to Platform objects.
358 current_platform = (None,)
359 return resolve_p537_wheel_names(
360 cache_dir=p537_resolve_cache,
361 targets=Targets(platforms=current_platform, interpreters=tuple(interpreters)),
362 )
363
364 other_python_version = PY311 if PY_VER == (3, 9) else PY39
365 other_python = PythonInterpreter.from_binary(ensure_python_interpreter(other_python_version))
366 current_python = PythonInterpreter.get()
367
368 resolved_other = resolve_current(interpreters=[other_python])
369 resolved_current = resolve_current()
370
371 assert 1 == len(resolved_other)
372 assert 1 == len(resolved_current)
373 assert resolved_other != resolved_current
374 assert resolved_current == resolve_current(interpreters=[current_python])
375 assert resolved_current == resolve_current(interpreters=[current_python, current_python])
376
377 # Here we have 2 local interpreters satisfying current but with different platforms and thus
378 # different dists for 2 total dists.
379 assert 2 == len(resolve_current(interpreters=[current_python, other_python]))
380
381
382@pytest.mark.skipif(

Callers

nothing calls this directly

Calls 4

resolve_currentFunction · 0.85
from_binaryMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected