diff options
Diffstat (limited to 'tests/functional/test_debug.py')
-rw-r--r-- | tests/functional/test_debug.py | 75 |
1 files changed, 41 insertions, 34 deletions
diff --git a/tests/functional/test_debug.py b/tests/functional/test_debug.py index 0e2261e1a..41374f8cb 100644 --- a/tests/functional/test_debug.py +++ b/tests/functional/test_debug.py @@ -1,86 +1,93 @@ +from typing import List + import pytest from pip._internal.commands.debug import create_vendor_txt_map from pip._internal.utils import compatibility_tags +from tests.lib import PipTestEnvironment -@pytest.mark.parametrize('expected_text', [ - 'sys.executable: ', - 'sys.getdefaultencoding: ', - 'sys.getfilesystemencoding: ', - 'locale.getpreferredencoding: ', - 'sys.platform: ', - 'sys.implementation:', - '\'cert\' config value: ', - 'REQUESTS_CA_BUNDLE: ', - 'CURL_CA_BUNDLE: ', - 'pip._vendor.certifi.where(): ', - 'pip._vendor.DEBUNDLED: ', - 'vendored library versions:', - -]) -def test_debug(script, expected_text): +@pytest.mark.parametrize( + "expected_text", + [ + "sys.executable: ", + "sys.getdefaultencoding: ", + "sys.getfilesystemencoding: ", + "locale.getpreferredencoding: ", + "sys.platform: ", + "sys.implementation:", + "'cert' config value: ", + "REQUESTS_CA_BUNDLE: ", + "CURL_CA_BUNDLE: ", + "pip._vendor.certifi.where(): ", + "pip._vendor.DEBUNDLED: ", + "vendored library versions:", + ], +) +def test_debug(script: PipTestEnvironment, expected_text: str) -> None: """ Check that certain strings are present in the output. """ - args = ['debug'] + args = ["debug"] result = script.pip(*args, allow_stderr_warning=True) stdout = result.stdout assert expected_text in stdout -def test_debug__library_versions(script): +def test_debug__library_versions(script: PipTestEnvironment) -> None: """ Check the library versions normal output. """ - args = ['debug'] + args = ["debug"] result = script.pip(*args, allow_stderr_warning=True) print(result.stdout) vendored_versions = create_vendor_txt_map() for name, value in vendored_versions.items(): - assert f'{name}=={value}' in result.stdout + assert f"{name}=={value}" in result.stdout @pytest.mark.parametrize( - 'args', + "args", [ [], - ['--verbose'], - ] + ["--verbose"], + ], ) -def test_debug__tags(script, args): +def test_debug__tags(script: PipTestEnvironment, args: List[str]) -> None: """ Check the compatible tag output. """ - args = ['debug'] + args + args = ["debug"] + args result = script.pip(*args, allow_stderr_warning=True) stdout = result.stdout tags = compatibility_tags.get_supported() - expected_tag_header = 'Compatible tags: {}'.format(len(tags)) + expected_tag_header = "Compatible tags: {}".format(len(tags)) assert expected_tag_header in stdout - show_verbose_note = '--verbose' not in args + show_verbose_note = "--verbose" not in args assert ( - '...\n [First 10 tags shown. Pass --verbose to show all.]' in stdout + "...\n [First 10 tags shown. Pass --verbose to show all.]" in stdout ) == show_verbose_note @pytest.mark.parametrize( - 'args, expected', + "args, expected", [ - (['--python-version', '3.7'], "(target: version_info='3.7')"), - ] + (["--python-version", "3.7"], "(target: version_info='3.7')"), + ], ) -def test_debug__target_options(script, args, expected): +def test_debug__target_options( + script: PipTestEnvironment, args: List[str], expected: str +) -> None: """ Check passing target-related options. """ - args = ['debug'] + args + args = ["debug"] + args result = script.pip(*args, allow_stderr_warning=True) stdout = result.stdout - assert 'Compatible tags: ' in stdout + assert "Compatible tags: " in stdout assert expected in stdout |