(
py27, # type: PythonInterpreter
py39, # type: PythonInterpreter
py311, # type: PythonInterpreter
current_interpreter, # type: PythonInterpreter
current_platform, # type: Platform
)
| 48 | |
| 49 | |
| 50 | def 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 | |
| 95 | def assert_python_requirement_applies( |
nothing calls this directly
no test coverage detected