Add importlib_resources to tests requirements file as workaround

Currently the dependency update job is failing[1] because one of the
tests installs multiple requirements files before running the tests and
it claims they have conflicting versions of `importlib_resources` (6.4.0
vs 6.4.4). 6.4.0 is in the pinned files and there is a 6.4.4 available.

Looking though the logs the first time I see importlib_resources==6.4.0
is when printing the requirements for the `test` requirements file.
But it's not mentioned at all when installing that file. Which makes me
think it found it's way into the virtualenv by some other means.

Looking at git blame for the test requirements lock file, it looks like
importlib_resources was introduced in
https://github.com/qutebrowser/qutebrowser/pull/8269 and indeed I can
see version 6.4.0 in setuptools vendored folder[2].

So it looks like this is another issue caused by setuptools adding their
vendored packages into sys.path.

Options I can see for resolving this:

a. add importlib_resources as a dependency in requirements.txt-raw so
  that we always pull down the newest one, even though we don't need it
b. add an @ignore line for importlib_resources
    * I think in the unlikely event we end up needing it then it being
      ignored might be hard to spot
c. drop python 3.8 support
d. switch to a requirements compilation method that doesn't use `pip
  freeze`

I've chosen (a) here because I think it's less surprising than (b), less
work than (c) and I already have a PR up for (d). And it's only pulled
down for 3.8 anyhow, so we'll drop this workaround when we drop that.

[1]: https://github.com/qutebrowser/qutebrowser/actions/runs/10660624684/job/29544897516
[2]: https://github.com/pypa/setuptools/tree/main/setuptools/_vendor
This commit is contained in:
toofar 2024-09-03 18:32:57 +12:00
parent 213a163623
commit 433074c681
1 changed files with 7 additions and 0 deletions

View File

@ -31,4 +31,11 @@ pytest-xdist
# Needed to test misc/userscripts/qute-lastpass
tldextract
# importlib_resources==6.4.0 is being included in the lock file via
# setuptools' vendored dependencies and conflicting with the more up to date
# one pulled down by other requirements files. Include it here even though we
# don't need to to make sure we at least get an up to date one.
importlib_resources
#@ markers: importlib_resources python_version=="3.8.*"
#@ ignore: Jinja2, MarkupSafe, colorama