From bfba43c4a8a3349f82651bfcfae64c40ae07a540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Sat, 31 Dec 2022 08:35:35 +0100 Subject: [PATCH] Relax test_list_installed_deps() to allow other packages (#2796) Relax the check in `test_list_installed_deps()` to allow `pip freeze` to return other packages before `pip`. This is necessary if the Python interpreter vendors some packages itself, so that they are available even in fresh venv. This is the case e.g. for cffi in PyPy. --- docs/changelog/2796.misc.rst | 3 +++ tests/tox_env/python/test_python_api.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 docs/changelog/2796.misc.rst diff --git a/docs/changelog/2796.misc.rst b/docs/changelog/2796.misc.rst new file mode 100644 index 000000000..3ea0d60d5 --- /dev/null +++ b/docs/changelog/2796.misc.rst @@ -0,0 +1,3 @@ +Relax the assertion in ``test_list_installed_deps`` to allow packages +other than ``pip`` to be present in the fresh venv, to fix tests +on PyPy. diff --git a/tests/tox_env/python/test_python_api.py b/tests/tox_env/python/test_python_api.py index 90e2ab655..0520ff173 100644 --- a/tests/tox_env/python/test_python_api.py +++ b/tests/tox_env/python/test_python_api.py @@ -186,6 +186,6 @@ def test_list_installed_deps(in_ci: bool, tox_project: ToxProjectCreator, mocker mocker.patch("tox.tox_env.python.api.is_ci", return_value=in_ci) result = tox_project({"tox.ini": "[testenv]\nskip_install = true"}).run("r", "-e", "py") if in_ci: - assert "py: pip==" in result.out + assert "pip==" in result.out else: - assert "py: pip==" not in result.out + assert "pip==" not in result.out