Commit Graph

1502 Commits

Author SHA1 Message Date
Mickaël Schoentgen
8374a9ed83
Review OSError exceptions handling (#1080)
- Replace obsolete `IOError` (Python 2) with `OSError`,
  cf https://docs.python.org/3/library/exceptions.html#OSError.
- Improve `OSError` catches at different places, simplifying
  the code.
2021-05-31 10:10:41 +02:00
Mickaël Schoentgen
a61f9e1114
Minor clean-up (#1078)
- Remove default arguments to `open()`.
- Make use of `pytest` mechanisms for temporary folders.
2021-05-29 12:06:06 +02:00
Mickaël Schoentgen
611b278b63
Fix --style colors list help indentation (#1077) 2021-05-28 12:45:40 +02:00
Jakub Roztocil
175e36da6b
Remove Python 3.10 build
Not supported by GitHub actions yet.
2021-05-27 20:19:55 +02:00
Jakub Roztocil
19e1e26d97
Add Python 3.10 build 2021-05-27 20:17:14 +02:00
Jannik Vieten
9b5aedb02d
updated fish shell completions (#1076) 2021-05-27 20:13:00 +02:00
Miro Hrončok
3865fabf09
Adapt doctest of tests.utils.http to work on Python 3.10 as well (#1075)
https://docs.python.org/3.10/whatsnew/3.10.html#enum

Python 3.10 changed the repr of enum members, and the doctest of tests.utils.http failed.
Exact reprs are unfortunately not considered stable API between Python releases:

    =================================== FAILURES ===================================
    __________________________ [doctest] tests.utils.http __________________________
    209
    210     Example:
    211
    212     $ http --auth=user:password GET pie.dev/basic-auth/user/password
    213
    214         >>> httpbin = getfixture('httpbin')
    215         >>> r = http('-a', 'user:pw', httpbin.url + '/basic-auth/user/pw')
    216         >>> type(r) == StrCLIResponse
    217         True
    218         >>> r.exit_status
    Expected:
        <ExitStatus.SUCCESS: 0>
    Got:
        ExitStatus.SUCCESS

A simple replacement of the expected output however breaks the doctest on Python 3.9.

This is the best solution I could think of
that keeps the docstring readable and doctest working in Pythons both old and new.
2021-05-27 19:54:33 +02:00
Miro Hrončok
355befcbfc
Skip http://pie.dev tests when offline (#1072) 2021-05-27 19:30:36 +02:00
Miro Hrončok
fc7a349d36
Declare a [test] extra with test dependencies (#1074)
Since `python setup.py test` is deprecated and `tests_require` is only used by that,
this allows to programmatically read the tests dependencies from the metadata.
2021-05-27 19:21:34 +02:00
Miro Hrončok
06ef27c576
Remove an useless shebang form non-executable file (#1073)
Shebangs have no function in non-executable files.
This file does not need to be directly executed.
2021-05-27 19:17:04 +02:00
Miro Hrončok
0e556ec3a8
pytest: Add hidden files to norecursedirs (#1071)
The default value already contains this,
but when setting a custom one, it was overridden.

In Fedora, we build the package in `.pyproject-builddir` and not ignoring it confuses pytest:

    _pytest.pathlib.ImportPathMismatchError: ('httpie.__main__', '/builddir/build/BUILD/httpie-2.4.0/.pyproject-builddir/pip-req-build-aedma65c/build/lib/httpie/__main__.py', PosixPath('/builddir/build/BUILD/httpie-2.4.0/.pyproject-builddir/pip-req-build-aedma65c/httpie/__main__.py'))
2021-05-27 16:59:57 +02:00
Mickaël Schoentgen
464b5b4c1d
Polish Python 2 removal (#1070) 2021-05-27 13:05:41 +02:00
Mickaël Schoentgen
264d45cdf5
Modernize the code base with f-strings in tests (#1069)
Simple concatenations were kept for readability purpose.
2021-05-26 14:09:38 +02:00
Mickaël Schoentgen
0ff0874fa3
Modernize the code base with f-strings (#1068) 2021-05-25 20:49:07 +02:00
Jakub Roztocil
39314887c4 README 2021-05-24 15:00:01 +02:00
Jakub Roztocil
f9a488d47e README 2021-05-24 14:40:08 +02:00
Mickaël Schoentgen
0001297f41
Add --raw to allow specifying the raw request body as an alternative to stdin (#1062)
* Add --raw to allow specifying the raw request body without extra processing

As an alternative to `stdin`.

Co-authored-by: Elena Lape <elapinskaite@gmail.com>
Co-authored-by: Jakub Roztocil <jakub@roztocil.co>

* Update README.rst

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>

* Update README.rst

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>

* Fix default HTTP method on empty data

Co-authored-by: Elena Lape <elapinskaite@gmail.com>
Co-authored-by: Jakub Roztocil <jakub@roztocil.co>
2021-05-24 14:29:54 +02:00
Mickaël Schoentgen
e2d43c14ce
Prefer usage of "python -m pip" instead of "pip" (#1059)
* Prefer usage of "python -m pip" instead of "pip"

It will prevent issues when users think that they are using
the correct `pip` version. It can refers to the one from the OS
Python installation, or even worse to a Python 2 installation.
Let's be clear on how to install stuff.

Also used short version of `pip` arguments, because we are all lazy :)

* Apply suggestions from code review
2021-05-05 14:17:04 +02:00
Mickaël Schoentgen
a3a08a9a22
Use relative imports (#1057)
* Use relative imports in test

* Use relative imports

* Add myself to contributors :)
2021-05-05 14:13:39 +02:00
Mickaël Schoentgen
7cbdf2c608
Prefer usage of pytest rather than py.test (#1058)
`py.test` was chosen over `pytest` but it is not planned for removal yet [1].
Anyway, it is a good thing to ensure we are using the correct Python version
with the right `pytest` installed, so using `python -m pytest` is recommended.

[1] https://github.com/pytest-dev/pytest/issues/1629
2021-05-03 18:40:25 +02:00
Mickaël Schoentgen
1274d869f6
Replace usage of mock with unittest.mock (#1054)
Since Python 3, the mock dependency is no more required as
it is already part of the unittest module.
2021-04-30 15:08:27 +02:00
Jan Verbeek
611bcdaab1
Fail gracefully if multiple request data files are supplied (#1042) 2021-04-15 09:35:50 +02:00
Miro Hrončok
fc45bf0fe3
Explicitly require setuptools, httpie/plugins/manager.py imports pkg_resources (#1049) 2021-03-30 22:54:53 +02:00
Almad
56c4ba1794
Warn against non-ascii in setup.cfg (#1041) 2021-02-24 14:56:57 +01:00
Almad
8f83bfe767
Replace typography quotes (#1040)
fixes #1039
2021-02-24 14:38:18 +01:00
Jakub Roztocil
a32ad344dd
Update README.rst 2021-02-23 12:51:06 +01:00
Jakub Roztocil
c53fbe5ae3
Typo 2021-02-23 12:22:35 +01:00
Jakub Roztocil
070ba9fa5a Tweaks 2021-02-18 13:48:48 +01:00
Jakub Roztocil
82ee071362 Tweaks 2021-02-18 13:47:58 +01:00
Jakub Roztocil
97dffb35a2 Spacing 2021-02-18 13:46:10 +01:00
Jakub Roztocil
18af03ac18 Issue templates tweaks II 2021-02-18 13:44:29 +01:00
Jakub Roztocil
904dd4107a Issue templates tweaks 2021-02-18 13:42:59 +01:00
Elena Lape
8efabc86e6
Issue templates (#1031)
* add bug report template

* add feature request template

* add other template

* a httpie to an httpie

Co-authored-by: bl-ue <54780737+bl-ue@users.noreply.github.com>

* Update .github/ISSUE_TEMPLATE/bug_report.md

Co-authored-by: bl-ue <54780737+bl-ue@users.noreply.github.com>

* Update .github/ISSUE_TEMPLATE/bug_report.md

Co-authored-by: bl-ue <54780737+bl-ue@users.noreply.github.com>

* Update .github/ISSUE_TEMPLATE/bug_report.md

Co-authored-by: bl-ue <54780737+bl-ue@users.noreply.github.com>

* minor changes

* add discord

Co-authored-by: bl-ue <54780737+bl-ue@users.noreply.github.com>
2021-02-18 12:55:15 +01:00
Jakub Roztocil
cc20488f49 Formatting 2021-02-14 13:34:20 +01:00
Jakub Roztocil
b918972862 CHANGELOG #1032 2021-02-14 13:33:38 +01:00
Jan Verbeek
84c7327057
Correctly handle single-byte Content-Range (#1032)
HTTPie previously failed if it continued a download with a single byte left.
2021-02-14 13:30:58 +01:00
Jakub Roztocil
e944dbd7fa 2.5.0-dev 2021-02-06 13:34:04 +01:00
Jakub Roztocil
157f3a1840
2021 2021-02-06 13:29:02 +01:00
Jakub Roztocil
61dbadb730 Tests 2021-02-06 13:21:21 +01:00
Jakub Roztocil
7be25d0751 Update brew formula to 2.4.0 2021-02-06 11:54:15 +01:00
Jakub Roztocil
5d5a8b4091 Typo 2021-02-06 11:26:15 +01:00
Jakub Roztocil
bb36897054 2.4.0 2021-02-06 11:17:24 +01:00
Jakub Roztocil
173e622567 Update upload command 2021-02-06 11:17:14 +01:00
Jakub Roztocil
3426030370 Fix README formatting 2021-02-06 11:13:04 +01:00
Jakub Roztocil
d014498713 Changelog entry for cookie expiration based on Set-Cookie: max-age=<n>
#1029
2021-02-06 11:02:26 +01:00
Jakub Roztocil
5414d1853e Refactoring
#1029
2021-02-06 10:58:36 +01:00
Jakub Roztocil
1ac8f69651 Add more output matching tests 2021-02-06 10:52:30 +01:00
Denis Belavin
3c07a25326
Add support for max-age=0 cookie expiry (#1029)
Close #998
2021-02-06 10:50:34 +01:00
Jakub Roztocil
cf78a12e46
Show --check-status warning with --quiet as well. (#1026)
Fixes #1028
2021-01-31 00:58:56 +01:00
Jakub Roztocil
0f1e098cc4
Fix incorrect separators and introduce assert_output_matches() (close #1027) 2021-01-30 22:14:57 +01:00