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
2 changes: 1 addition & 1 deletion httpie/cli/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def parse_known_args(self, args=None, namespace=None):
return super().parse_known_args(args, namespace)
except SystemExit as exc:
if not hasattr(self, 'root') and exc.code == 2: # Argument Parser Error
raise argparse.ArgumentError(None, None)
raise argparse.ArgumentError(None, None) from exc
raise


Expand Down
2 changes: 1 addition & 1 deletion httpie/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def func(instance):

def __init__(self, func, name=None):
self.real_func = func
self.__doc__ = getattr(func, '__doc__')
self.__doc__ = func.__doc__

def __set_name__(self, owner, name):
if self.name is None:
Expand Down
4 changes: 2 additions & 2 deletions httpie/output/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ def iter_body(self) -> Iterable[bytes]:
converter = self.conversion.get_converter(self.mime)
if converter:
body = bytearray()
# noinspection PyAssignmentToLoopOrWithParameter
for line, lf in chain([(line, lf)], iter_lines):
for _line, _lf in chain([(line, lf)], iter_lines):
line, lf = _line, _lf
body.extend(line)
body.extend(lf)
self.mime, body = converter.convert(body)
Expand Down
2 changes: 1 addition & 1 deletion httpie/ssl_.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def _is_key_file_encrypted(key_file):
Copy of the internal urllib function (urllib3.util.ssl_)"""

with open(key_file, "r") as f:
with open(key_file) as f:
for line in f:
# Look for Proc-Type: 4,ENCRYPTED
if "ENCRYPTED" in line:
Expand Down
7 changes: 7 additions & 0 deletions tests/test_cli_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,17 @@ def test_lazy_choices():


def test_lazy_choices_help():
import sys
mock = Mock()
getter = mock.getter
getter.return_value = ['a', 'b', 'c']

# Python 3.14+ calls getter during argparse initialisation
if sys.version_info >= (3, 14):
from unittest.mock import ANY
getter.assert_called()
getter.reset_mock()

help_formatter = mock.help_formatter
help_formatter.return_value = '<my help>'

Expand Down
Loading