提交 00665d11 编写于 作者: C Chris Jerdonek

Add some encoding return values to pip-debug.

上级 7b587203
from __future__ import absolute_import from __future__ import absolute_import
import locale
import logging import logging
import sys import sys
...@@ -100,6 +101,11 @@ class DebugCommand(Command): ...@@ -100,6 +101,11 @@ class DebugCommand(Command):
show_value('pip version', get_pip_version()) show_value('pip version', get_pip_version())
show_value('sys.version', sys.version) show_value('sys.version', sys.version)
show_value('sys.executable', sys.executable) show_value('sys.executable', sys.executable)
show_value('sys.getdefaultencoding', sys.getdefaultencoding())
show_value('sys.getfilesystemencoding', sys.getfilesystemencoding())
show_value(
'locale.getpreferredencoding', locale.getpreferredencoding(),
)
show_value('sys.platform', sys.platform) show_value('sys.platform', sys.platform)
show_sys_implementation() show_sys_implementation()
......
...@@ -3,6 +3,25 @@ import pytest ...@@ -3,6 +3,25 @@ import pytest
from pip._internal import pep425tags from pip._internal import pep425tags
@pytest.mark.parametrize('expected_text', [
'sys.executable: ',
'sys.getdefaultencoding: ',
'sys.getfilesystemencoding: ',
'locale.getpreferredencoding: ',
'sys.platform: ',
'sys.implementation:',
])
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
@pytest.mark.parametrize( @pytest.mark.parametrize(
'args', 'args',
[ [
...@@ -10,18 +29,14 @@ from pip._internal import pep425tags ...@@ -10,18 +29,14 @@ from pip._internal import pep425tags
['--verbose'], ['--verbose'],
] ]
) )
def test_debug(script, args): def test_debug__tags(script, args):
""" """
Check simple option cases. Check the compatible tag output.
""" """
args = ['debug'] + args args = ['debug'] + args
result = script.pip(*args, allow_stderr_warning=True) result = script.pip(*args, allow_stderr_warning=True)
stdout = result.stdout stdout = result.stdout
assert 'sys.executable: ' in stdout
assert 'sys.platform: ' in stdout
assert 'sys.implementation:' in stdout
tags = pep425tags.get_supported() tags = pep425tags.get_supported()
expected_tag_header = 'Compatible tags: {}'.format(len(tags)) expected_tag_header = 'Compatible tags: {}'.format(len(tags))
assert expected_tag_header in stdout assert expected_tag_header in stdout
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册