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

Function test_unique_targets

tests/test_targets.py:50–92  ·  view source on GitHub ↗
(
    py27,  # type: PythonInterpreter
    py39,  # type: PythonInterpreter
    py311,  # type: PythonInterpreter
    current_interpreter,  # type: PythonInterpreter
    current_platform,  # type: Platform
)

Source from the content-addressed store, hash-verified

48
49
50def test_unique_targets(
51 py27, # type: PythonInterpreter
52 py39, # type: PythonInterpreter
53 py311, # type: PythonInterpreter
54 current_interpreter, # type: PythonInterpreter
55 current_platform, # type: Platform
56):
57 # type: (...) -> None
58 assert (
59 OrderedSet([targets.current()]) == Targets().unique_targets()
60 ), "Expected the default TargetConfiguration to produce the current interpreter."
61
62 assert OrderedSet([targets.current()]) == Targets(platforms=(None,)).unique_targets(), (
63 "Expected the 'current' platform - which maps to `None` - to produce the current "
64 "interpreter when no interpreters were configured."
65 )
66
67 assert (
68 OrderedSet([LocalInterpreter.create(py27)])
69 == Targets(interpreters=(py27,), platforms=(None,)).unique_targets()
70 ), (
71 "Expected the 'current' platform - which maps to `None` - to be ignored when at least one "
72 "concrete interpreter for the current platform is configured."
73 )
74
75 assert (
76 OrderedSet([AbbreviatedPlatform.create(current_platform)])
77 == Targets(platforms=(current_platform,)).unique_targets()
78 )
79
80 assert (
81 OrderedSet(LocalInterpreter.create(i) for i in (py27, py39, py311))
82 == Targets(interpreters=(py27, py39, py311)).unique_targets()
83 )
84
85 complete_platform_current = CompletePlatform.from_interpreter(current_interpreter)
86 complete_platform_py27 = CompletePlatform.from_interpreter(py27)
87 assert (
88 OrderedSet([complete_platform_current, complete_platform_py27])
89 == Targets(
90 complete_platforms=(complete_platform_current, complete_platform_py27)
91 ).unique_targets()
92 )
93
94
95def assert_python_requirement_applies(

Callers

nothing calls this directly

Calls 6

OrderedSetClass · 0.90
TargetsClass · 0.90
unique_targetsMethod · 0.80
from_interpreterMethod · 0.80
currentMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected