|
| 1 | +# Three lock universes (`canonical`, `duplicate`, `triplicate`) over a shared |
| 2 | +# set of pure-bdist packages, with slightly varying deps and exclude_glob |
| 3 | +# overrides (see setup.MODULE.bazel). Each test builds+runs against the shared |
| 4 | +# deduplicated install repos, proving the reference rewrite leaves no dangling |
| 5 | +# label. The //snapshots dedup-installs entry pins the dedup signature. |
| 6 | +load("@aspect_rules_py//py:defs.bzl", "py_test") |
| 7 | + |
| 8 | +# The seven packages every project shares. canonical/duplicate add mccabe. |
| 9 | +_COMMON_PACKAGES = [ |
| 10 | + "@pypi_dedup//cachetools", |
| 11 | + "@pypi_dedup//decorator", |
| 12 | + "@pypi_dedup//distlib", |
| 13 | + "@pypi_dedup//inflection", |
| 14 | + "@pypi_dedup//pycodestyle", |
| 15 | + "@pypi_dedup//pyflakes", |
| 16 | + "@pypi_dedup//sortedcontainers", |
| 17 | + "@pypi_dedup//toml", |
| 18 | +] |
| 19 | + |
| 20 | +# The dedup proof: enumerate every wheel-install repo reachable from all three |
| 21 | +# lock universes. The query is unconfigured, so it walks every select() arm of |
| 22 | +# all three projects. Without the dedup this lists 26 repos (canonical 9 + |
| 23 | +# duplicate 9 + triplicate 8); the pinned snapshot has 12 — the surviving |
| 24 | +# identities after collapsing matching (wheels, exclude_glob) installs. |
| 25 | +genquery( |
| 26 | + name = "shared_install_repos", |
| 27 | + expression = "filter(\"whl_install__shared_install_.*//:install$\", deps(//dedup-installs:canonical) + deps(//dedup-installs:duplicate) + deps(//dedup-installs:triplicate))", |
| 28 | + scope = [ |
| 29 | + "//dedup-installs:canonical", |
| 30 | + "//dedup-installs:duplicate", |
| 31 | + "//dedup-installs:triplicate", |
| 32 | + ], |
| 33 | + visibility = ["//:__pkg__"], |
| 34 | +) |
| 35 | + |
| 36 | +# Each test resolves its packages through its own project's dep_group config, |
| 37 | +# so the three lock universes are exercised independently while landing on the |
| 38 | +# shared install repos. The smoke test imports only the common packages so it |
| 39 | +# runs unchanged against triplicate (which omits mccabe); pyflakes and |
| 40 | +# pycodestyle are imported to prove the exclude_glob installs still work. |
| 41 | +py_test( |
| 42 | + name = "canonical", |
| 43 | + srcs = ["__test__.py"], |
| 44 | + dep_group = "shared-install-canonical", |
| 45 | + main = "__test__.py", |
| 46 | + python_version = "3.11", |
| 47 | + deps = _COMMON_PACKAGES + ["@pypi_dedup//mccabe"], |
| 48 | +) |
| 49 | + |
| 50 | +py_test( |
| 51 | + name = "duplicate", |
| 52 | + srcs = ["__test__.py"], |
| 53 | + dep_group = "shared-install-duplicate", |
| 54 | + main = "__test__.py", |
| 55 | + python_version = "3.11", |
| 56 | + deps = _COMMON_PACKAGES + ["@pypi_dedup//mccabe"], |
| 57 | +) |
| 58 | + |
| 59 | +py_test( |
| 60 | + name = "triplicate", |
| 61 | + srcs = ["__test__.py"], |
| 62 | + dep_group = "shared-install-triplicate", |
| 63 | + main = "__test__.py", |
| 64 | + python_version = "3.11", |
| 65 | + deps = _COMMON_PACKAGES, |
| 66 | +) |
0 commit comments