Perform relaxed version matching in `pip debug` test
This ensures that we're not trying to compare versions as equal strings.
+import re
from typing import List
import pytest
+from pip._vendor.packaging.version import Version
from pip._internal.commands.debug import create_vendor_txt_map
from pip._internal.utils import compatibility_tags
@@ -45,7 +47,9 @@ def test_debug__library_versions(script: PipTestEnvironment) -> None:
vendored_versions = create_vendor_txt_map()
for name, value in vendored_versions.items():
- assert f"{name}=={value}" in result.stdout
+ match = re.search(rf"{name}==(\S+)", result.stdout)
+ assert match is not None, f"Could not find {name} in output"
+ assert Version(match.group(1)) == Version(value)
@pytest.mark.parametrize(
