Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ jobs:
- '3.8'
- '3.7'
pyopenssl: [0, 1]
runs-on: ${{ matrix.os }}
runs-on: >-
${{
matrix.os == 'ubuntu-latest' &&
matrix.python-version == '3.7' &&
'ubuntu-22.04' ||
matrix.os
}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
Expand Down
2 changes: 1 addition & 1 deletion httpie/manager/tasks/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def _install(self, targets: List[str], mode='install') -> Tuple[
if self.debug:
self.env.stderr.write('Command failed: ')
self.env.stderr.write('pip ' + ' '.join(pip_args) + '\n')
self.env.stderr.write(textwrap.indent(' ', stderr))
self.env.stderr.write(textwrap.indent(stderr, ' '))

last_line = stderr.strip().splitlines()[-1]
severity, _, message = last_line.partition(': ')
Expand Down
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ project_urls =
packages = find:
install_requires =
pip
charset_normalizer>=2.0.0
charset_normalizer>=2.0.0,<3.4.2
defusedxml>=0.6.0
requests[socks] >=2.22.0
Pygments>=2.5.2
requests-toolbelt>=0.9.1
multidict>=4.7.0
multidict>=4.7.0,!=6.5.0
setuptools
importlib-metadata>=1.4.0; python_version<"3.8"
rich>=9.10.0
Expand Down Expand Up @@ -90,7 +90,7 @@ dev =
flake8-deprecated
flake8-mutable
flake8-tuple
pyopenssl
pyopenssl<26
pytest-cov
pyyaml
twine
Expand Down
18 changes: 15 additions & 3 deletions tests/test_cli_ui.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import pytest
import shutil
import os
import shutil
import sys

import pytest

from tests.utils import http

NAKED_BASE_TEMPLATE = """\
Expand All @@ -25,9 +28,18 @@
error_msg="argument --pretty: expected one argument"
)

PRETTY_INVALID_CHOICES = (
"all, colors, format, none"
if sys.version_info >= (3, 12)
else "'all', 'colors', 'format', 'none'"
)

NAKED_HELP_MESSAGE_PRETTY_WITH_INVALID_ARG = NAKED_BASE_TEMPLATE.format(
extra_args="--pretty {all, colors, format, none} ",
error_msg="argument --pretty: invalid choice: '$invalid' (choose from 'all', 'colors', 'format', 'none')"
error_msg=(
"argument --pretty: invalid choice: '$invalid' "
f"(choose from {PRETTY_INVALID_CHOICES})"
)
)


Expand Down
13 changes: 10 additions & 3 deletions tests/utils/plugins_cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import secrets
import site
import sys
Expand Down Expand Up @@ -217,8 +218,14 @@ def runner(*args, cli_mode: bool = True):
# Prevent installed plugins from showing up.
original_plugins = plugin_manager.copy()
clean_sys_path = set(sys.path).difference(site.getsitepackages())
# These dummy plugins do not need isolated build dependencies, and the
# suite's pytest-httpbin CA bundle is only for test servers. If pip
# inherits it, plugin installs cannot verify PyPI's certificate.
with patch('sys.path', list(clean_sys_path)):
response = httpie(*args, env=interface.environment)
with patch.dict(os.environ, {'PIP_NO_BUILD_ISOLATION': '1'}, clear=False):
os.environ.pop('REQUESTS_CA_BUNDLE', None)
os.environ.pop('CURL_CA_BUNDLE', None)
response = httpie(*args, env=interface.environment)
plugin_manager.clear()
plugin_manager.extend(original_plugins)
return response
Expand All @@ -229,7 +236,7 @@ def runner(*args, cli_mode: bool = True):
@pytest.fixture
def httpie_plugins_success(httpie_plugins):
def runner(*args, cli_mode: bool = True):
response = httpie_plugins(*args, cli_mode=True)
assert response.exit_status == ExitStatus.SUCCESS
response = httpie_plugins(*args, cli_mode=cli_mode)
assert response.exit_status == ExitStatus.SUCCESS, response.stderr
return response.splitlines()
return runner
Loading