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

Function test_exclude_root_reqs

tests/test_dependency_manager.py:105–142  ·  view source on GitHub ↗
(dist_graph)

Source from the content-addressed store, hash-verified

103
104
105def test_exclude_root_reqs(dist_graph):
106 # type: (DistGraph) -> None
107
108 dependency_manager = DependencyManager(
109 requirements=OrderedSet(dist_graph.root_reqs), distributions=OrderedSet(dist_graph.dists)
110 )
111
112 pex_info = PexInfo.default()
113 pex_builder = PEXBuilder(pex_info=pex_info)
114
115 with warnings.catch_warnings(record=True) as events:
116 dependency_manager.configure(
117 pex_builder, dependency_configuration=DependencyConfiguration.create(["a", "b"])
118 )
119 assert 2 == len(events)
120
121 warning = events[0]
122 assert PEXWarning == warning.category
123 assert (
124 "The distribution A 0.1.0 was required by the input requirement a but ultimately excluded "
125 "by configured excludes: a"
126 ) == str(warning.message)
127
128 warning = events[1]
129 assert PEXWarning == warning.category
130 assert (
131 "The distribution B 0.1.0 was required by the input requirement b but ultimately excluded "
132 "by configured excludes: b"
133 ) == str(warning.message)
134
135 pex_builder.freeze()
136
137 assert ["a", "b"] == list(pex_info.requirements)
138 assert ["a", "b"] == list(pex_info.excluded)
139 assert sorted(("C", "D", "E", "F")) == sorted(pex_info.distributions), (
140 "The dependency manager should have excluded the root reqs itself but relied on deep "
141 "excludes plumbed to Pip to exclude transitive dependencies of the roots."
142 )
143
144
145def test_exclude_transitive_assert(dist_graph):

Callers

nothing calls this directly

Calls 7

configureMethod · 0.95
freezeMethod · 0.95
DependencyManagerClass · 0.90
OrderedSetClass · 0.90
PEXBuilderClass · 0.90
defaultMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected