• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 25200338051

01 May 2026 03:07AM UTC coverage: 92.955%. Remained the same
25200338051

push

github

web-flow
fix `test_range_deps` in plugin resolver test  to not use real `requests` distribution (#23299)

## Overview

Modify `test_range_deps` in
`src/python/pants/init/plugin_resolver_test.py` to not use `requests` as
the transitive dependency to verify the plugin resolver's behavior.
Instead, use a non-existent distribution because otherwise the version
of `requests` loaded in the test environment's `sys.path` could affect
the test (and cause a spurious failure).

Motivation is [this build
failure](https://github.com/pantsbuild/pants/actions/runs/24785703939/job/72530152547#step:12:438)
in [this other PR](https://github.com/pantsbuild/pants/pull/23284):

```
_______________________________ test_range_deps ________________________________

rule_runner = RuleRunner(build_root=/tmp/_BUILD_ROOTfn0lzflq)

    def test_range_deps(rule_runner: RuleRunner) -> None:
        # Test that when a plugin has a range dependency, specifying a working set constrains
        # to a particular version, where otherwise we would get the highest released (2.27.1 in
        # this case).
        with plugin_resolution(
            rule_runner,
            plugins=[Plugin("jane", "3.4.5", ["requests>=2.25.1,<2.28.0"])],
            existing_distributions=[MockDistribution(name="requests", version=Version("2.26.0"))],
            # Because we're resolving real distributions, we enable access to pypi.
            use_pypi=True,
        ) as (
            _,
            _,
            _,
            _,
        ):
            dist = importlib.metadata.distribution("requests")
>           assert "2.27.1" == dist.version
E           AssertionError: assert equals failed
E             '2.27.1'  '2.32.5'

src/python/pants/init/plugin_resolver_test.py:360: AssertionError
=============================== warnings summary ===============================
src/python/pants/init/plugin_resolver_test.py::test_no_plugins
  /opt/hostedtoolcache/Python/3.14.2/x64/lib/python3.14/ctypes/_endian.py:33: D... (continued)

91825 of 98784 relevant lines covered (92.96%)

4.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

99.41
/src/python/pants/init/plugin_resolver_test.py


Build SHA Not Found

The commit SHA "99e2f83bd6097efcd18f37257fc8e2bc97111564" was not found in your repository, so the file cannot be loaded. This may be because you posted from a local development environment, or your CI created an ephemeral commit.

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc