2019-06-23 17:54:38 +02:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
from pip._internal import pep425tags
|
|
|
|
|
|
|
|
|
2019-07-20 03:52:54 +02:00
|
|
|
@pytest.mark.parametrize('expected_text', [
|
|
|
|
'sys.executable: ',
|
|
|
|
'sys.getdefaultencoding: ',
|
|
|
|
'sys.getfilesystemencoding: ',
|
|
|
|
'locale.getpreferredencoding: ',
|
|
|
|
'sys.platform: ',
|
|
|
|
'sys.implementation:',
|
2019-10-17 09:01:49 +02:00
|
|
|
'\'cert\' config value: ',
|
2019-10-15 11:24:34 +02:00
|
|
|
'REQUESTS_CA_BUNDLE: ',
|
|
|
|
'CURL_CA_BUNDLE: ',
|
|
|
|
'pip._vendor.certifi.where(): ',
|
2019-10-17 09:01:49 +02:00
|
|
|
|
2019-07-20 03:52:54 +02:00
|
|
|
])
|
|
|
|
def test_debug(script, expected_text):
|
|
|
|
"""
|
|
|
|
Check that certain strings are present in the output.
|
|
|
|
"""
|
|
|
|
args = ['debug']
|
|
|
|
result = script.pip(*args, allow_stderr_warning=True)
|
|
|
|
stdout = result.stdout
|
|
|
|
|
|
|
|
assert expected_text in stdout
|
|
|
|
|
|
|
|
|
2019-06-23 17:54:38 +02:00
|
|
|
@pytest.mark.parametrize(
|
|
|
|
'args',
|
|
|
|
[
|
|
|
|
[],
|
|
|
|
['--verbose'],
|
|
|
|
]
|
|
|
|
)
|
2019-07-20 03:52:54 +02:00
|
|
|
def test_debug__tags(script, args):
|
2019-06-23 17:54:38 +02:00
|
|
|
"""
|
2019-07-20 03:52:54 +02:00
|
|
|
Check the compatible tag output.
|
2019-06-23 17:54:38 +02:00
|
|
|
"""
|
|
|
|
args = ['debug'] + args
|
2019-07-18 11:32:26 +02:00
|
|
|
result = script.pip(*args, allow_stderr_warning=True)
|
2019-06-23 17:54:38 +02:00
|
|
|
stdout = result.stdout
|
|
|
|
|
|
|
|
tags = pep425tags.get_supported()
|
|
|
|
expected_tag_header = 'Compatible tags: {}'.format(len(tags))
|
|
|
|
assert expected_tag_header in stdout
|
|
|
|
|
|
|
|
show_verbose_note = '--verbose' not in args
|
|
|
|
assert (
|
|
|
|
'...\n [First 10 tags shown. Pass --verbose to show all.]' in stdout
|
|
|
|
) == show_verbose_note
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
|
|
'args, expected',
|
|
|
|
[
|
|
|
|
(['--python-version', '3.7'], "(target: version_info='3.7')"),
|
|
|
|
]
|
|
|
|
)
|
|
|
|
def test_debug__target_options(script, args, expected):
|
|
|
|
"""
|
|
|
|
Check passing target-related options.
|
|
|
|
"""
|
|
|
|
args = ['debug'] + args
|
2019-07-18 11:32:26 +02:00
|
|
|
result = script.pip(*args, allow_stderr_warning=True)
|
2019-06-23 17:54:38 +02:00
|
|
|
stdout = result.stdout
|
|
|
|
|
|
|
|
assert 'Compatible tags: ' in stdout
|
|
|
|
assert expected in stdout
|