|
10 | 10 | get_policy_name,
|
11 | 11 | get_priority_by_name,
|
12 | 12 | get_replace_platforms,
|
| 13 | + lddtree_external_references, |
13 | 14 | )
|
14 | 15 |
|
15 | 16 |
|
@@ -202,3 +203,32 @@ def test_get_by_name_missing(self):
|
202 | 203 | def test_get_by_name_duplicate(self):
|
203 | 204 | with pytest.raises(RuntimeError):
|
204 | 205 | get_priority_by_name("duplicate")
|
| 206 | + |
| 207 | + |
| 208 | +class TestLddTreeExternalReferences: |
| 209 | + """Tests for lddtree_external_references.""" |
| 210 | + |
| 211 | + def test_filter_libs(self): |
| 212 | + """Test the nested filter_libs function.""" |
| 213 | + filtered_libs = [ |
| 214 | + "ld-linux-x86_64.so.1", |
| 215 | + "ld64.so.1", |
| 216 | + "ld64.so.2", |
| 217 | + "libpython3.7m.so.1.0", |
| 218 | + "libpython3.9.so.1.0", |
| 219 | + "libpython3.10.so.1.0", |
| 220 | + "libpython999.999.so.1.0", |
| 221 | + ] |
| 222 | + unfiltered_libs = ["libfoo.so.1.0", "libbar.so.999.999.999"] |
| 223 | + libs = filtered_libs + unfiltered_libs |
| 224 | + |
| 225 | + lddtree = { |
| 226 | + "realpath": "/path/to/lib", |
| 227 | + "needed": libs, |
| 228 | + "libs": {lib: {"needed": [], "realpath": "/path/to/lib"} for lib in libs}, |
| 229 | + } |
| 230 | + full_external_refs = lddtree_external_references(lddtree, "/path/to/wheel") |
| 231 | + |
| 232 | + # Assert that each policy only has the unfiltered libs. |
| 233 | + for policy in full_external_refs: |
| 234 | + assert set(full_external_refs[policy]["libs"]) == set(unfiltered_libs) |
0 commit comments