Commit Graph

1360 Commits

Author SHA1 Message Date
Mickaël Schoentgen
2d55c01c7e
Fix printing redirected prepared request in verbose mode (#1088) 2021-06-15 13:39:46 +02:00
Mickaël Schoentgen
1470ca0c77
CI: Do not fail fast to have a real view of potential failures (#1090) 2021-06-11 20:55:51 +02:00
Mickaël Schoentgen
9857693ebf
Use a more modern approach to run tests (#1089)
Running tests through `python setup.py test` is deprecated:

> WARNING: Testing via this command is deprecated and will be removed
> in a future version. Users looking for a generic test entry point
> independent of test runner are encouraged to use tox.

I am not in favor of moving back to `tox`, we should simply run tests
using `python -m pytest` (or `make test`) and that's it.

A new extra was added, `dev`, to install development requirements:

    $ python -m pip install --upgrade --editable '.[dev]'
2021-06-11 20:55:26 +02:00
Miro Hrončok
da03a0656e
Add a Packit configuration for Fedora packaging (#1086)
* Add Packit configuration for Fedora packaging

 - all pull requests are build-tested in https://copr.fedorainfracloud.org
 - new releases will create pull requests in https://src.fedoraproject.org/rpms/httpie

Co-authored-by: Mickaël Schoentgen <contact@tiger-222.fr>
2021-06-09 17:18:27 +02:00
Mickaël Schoentgen
61f1ffd0eb
Prevent installation of test files (#1087)
(They’re still included in the package as per #182)
2021-06-09 17:14:27 +02:00
Mickaël Schoentgen
9792513c68
Add a reproduction test case for #1082 (#1085)
The fix may actually be slightly more complex than I expected.
We would need, at first sight, to loose the prepared requests + responses streaming.

A potential solution will come in a near future.
2021-06-09 09:43:06 +02:00
Mickaël Schoentgen
350f973f70
Switch from pycodestyle to flake8 for code style checks (#1083) 2021-06-02 11:06:46 +02:00
Mickaël Schoentgen
8d35a12d27
Fix several issues found with flake8 (#1081) 2021-06-01 14:46:58 +02:00
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