From 84ad55a7807060a3bfe2c9d4857d541439959945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Thu, 2 May 2024 18:48:47 +0200 Subject: [PATCH] Fix test_show_require_invalid_version with pkg_resources backend The pkg_ressources metadata backend does not suffer from invalid metadata in this test case. --- tests/functional/test_invalid_versions_and_specifiers.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/functional/test_invalid_versions_and_specifiers.py b/tests/functional/test_invalid_versions_and_specifiers.py index f48b92be71e..21ce02085fc 100644 --- a/tests/functional/test_invalid_versions_and_specifiers.py +++ b/tests/functional/test_invalid_versions_and_specifiers.py @@ -2,6 +2,7 @@ import pytest +from pip._internal.metadata import select_backend from tests.lib import PipTestEnvironment, TestData @@ -130,4 +131,9 @@ def test_show_require_invalid_version( result = script.pip("show", "require-invalid-version") assert "Name: require-invalid-version\nVersion: 1.0\n" in result.stdout assert "Requires: invalid-version ==2010i\n" in result.stdout - assert "Required-by: #N/A\n" in result.stdout + if select_backend().NAME == "importlib": + assert "Required-by: #N/A\n" in result.stdout + elif select_backend().NAME == "pkg_resources": + assert "Required-by: \n" in result.stdout + else: + assert False, "Unknown metadata backend"