Commit Graph

38 Commits

Author SHA1 Message Date
Martijn Pieters
933551c519
Typing: enable disallow_untyped_calls (#2479)
* Typing: enable disallow_untyped_calls

Only the test suite needed adjusting to add type hints.

* Update setup.cfg

Co-authored-by: Tom Christie <tom@tomchristie.com>
2022-12-02 10:47:42 +00:00
Martijn Pieters
884a69a902
Typing: enable strict_equality (#2480)
- ignore mypy when it comes to comparing an IntEnum member with an int
- Correct type hint for `test_wsgi_server_port`'s `expected_server_port`
  parameter.

Co-authored-by: Tom Christie <tom@tomchristie.com>
2022-12-02 08:45:28 +00:00
Martijn Pieters
57aa5b08a4
Enable no_implicit_reexport (#2475)
- Add explicit exports for names imported from `_compat`
- Correct imports of `URL` (from `._urls`, not via `._models`)
- Correct import of the uvicorn `Server` class

Co-authored-by: Tom Christie <tom@tomchristie.com>
2022-11-30 13:11:22 +00:00
Martijn Pieters
2d37321842
Typing: enable warn_return_any (#2477) 2022-11-30 13:08:02 +00:00
Martijn Pieters
049afe5b25
Typing: enable disallow_incomplete_defs (#2476)
The only places mypy reports issues is in the test suite.
2022-11-30 09:04:54 +00:00
Adrian Garcia Badaracco
69e13cbc39
Remove and dissallow unused type ignores (#2470)
* Remove and dissallow unused type ignores

* add pragmas

* fix ignore
2022-11-29 16:55:45 +00:00
Adrian Garcia Badaracco
1fc6a52546
Add mypy flags (#2472) 2022-11-29 16:46:00 +00:00
Adrian Garcia Badaracco
1b4e7fbb48
Typing: always fill in generic type parameters (#2468)
* Typing: always fill in generic type parameters

Being explicit about the parameters helps find bugs and makes the library
easier to use for users.

- Tell mypy to disallow generics without parameter values
- Give all generic types parameters values

* fix things that aren't coming in from other commits

* lint

Co-authored-by: Martijn Pieters <mj@zopatista.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
2022-11-29 16:36:03 +00:00
Vincent Fazio
1aea9539bb
Drop cgi module from test_multipart (#2424)
* Use multipart instead of cgi for multipart tests

The cgi module has been deprecated as of python 3.11.

Signed-off-by: Vincent Fazio <vfazio@gmail.com>

* Update setup.cfg

All references to the cgi module have all been removed so there's no
longer a need to silence those deprecation warnings.

The deprecation warning for certifi is resolved as of version 2022.09.24.

Signed-off-by: Vincent Fazio <vfazio@gmail.com>

Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
2022-11-03 11:29:23 +00:00
Jo
8088fc7ff7
Test under 3.11-dev (#2302)
* Test under 3.11.0-beta.3

* Ignore cgi and importlib warnings

* Ignore src_constant warning

* Install whell before other requirements

* Minor

* Remove uvicorn ignore

* Use 3.11-dev instead

* Add 3.11 to classifiers

* Revert unrelated change

* Bump coverage
2022-09-29 17:00:21 +01:00
dependabot[bot]
132ccd9834
Bump pytest-asyncio from 0.16.0 to 0.18.3 (#2198)
* Bump pytest-asyncio from 0.16.0 to 0.18.3

Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.16.0 to 0.18.3.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Changelog](https://github.com/pytest-dev/pytest-asyncio/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.16.0...v0.18.3)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update setup.cfg

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
2022-06-17 11:19:35 +01:00
Michael Oliver
14a1704be5
Switch to explicit typing.Optional throughout (#2096)
* Fix issue with Mypy `--strict` and `AsyncExitStack`

* Enable `no_implicit_optional` in Mypy

* Ignore internal type errors

* Bump `httpcore`

* Remove unneeded type: ignore comments

Co-authored-by: Florimond Manca <florimond.manca@protonmail.com>
Co-authored-by: Michael Oliver <michael@michaeloliver.dev>
2022-05-20 11:12:25 +01:00
dependabot[bot]
fa03b489f0
Bump flake8-pie from 0.5.0 to 0.15.0 (#1879)
* Bump flake8-pie from 0.5.0 to 0.15.0

Bumps [flake8-pie](https://github.com/sbdchd/flake8-pie) from 0.5.0 to 0.15.0.
- [Release notes](https://github.com/sbdchd/flake8-pie/releases)
- [Commits](https://github.com/sbdchd/flake8-pie/commits)

---
updated-dependencies:
- dependency-name: flake8-pie
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Don't use PIE on 3.6

* Adhere or ignore new rules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
Co-authored-by: Florimond Manca <florimond.manca@protonmail.com>
2021-10-15 12:03:53 +02:00
Antonio Larrosa
77193b2ab6
Add a network pytest mark for tests that use the network (#1669)
* Add a network pytest mark for tests that use the network

Sometimes it's useful to have the tests that use the network
marked so they can be skipped easily when we know the network
is not available.

This is useful for example on SUSE and openSUSE's build servers.
When building the httpx packages (actually, any package in the
distribution) the network is disabled so we can assure
reproducible builds (among other benefits). With this mark, it's
easier to skip tests that can not succeed.

* Add a better explanation for the network marker

Co-authored-by: Florimond Manca <15911462+florimondmanca@users.noreply.github.com>

Co-authored-by: Joe <nigelchiang@outlook.com>
Co-authored-by: Florimond Manca <15911462+florimondmanca@users.noreply.github.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
2021-08-13 14:13:43 +01:00
Tom Christie
b43af721cd
Treat warnings as errors (#1687)
* Treat warnings as errors

* Defensive programming in Client.__del__ to avoid possible warnings on partially initialized instances

* Linting

* Ignore linting getattr errors in __del__

* getattr requires a default

* Tighten up closing of auth_flow generators

* Switch multipart test to open file in a context manager

* Ignore warnings on uvicorn

* Drop -Werror from addopts

* Warings specified entirely in 'filterwarnings' section

* Use ssl.PROTOCOL_TLS_CLIENT instead of deprecated ssl.PROTOCOL_TLS

* Push 'check_hostname = False' above 'context.verify_mode = ssl.CERT_NONE'

* Introduce set_minimum_tls_version_1_2 compatible across different python versions

* Commenting

* Add missing annotation

* Exclude _compat from coverage

Co-authored-by: Joe <nigelchiang@outlook.com>
Co-authored-by: jianghang <jianghang@didiglobal.com>
2021-06-16 15:34:12 +01:00
cdeler
72a1f2c759
Replacing pytest-cov by coverage (#1353) 2020-10-08 13:05:30 +01:00
Johannes
ac7704e78c
Remove seed-isort-config (#1321)
As of isort 5 seed-isort-config is no longer needed.

We can get rid of some explicit config too as it's now more clever.
2020-09-24 11:08:07 +01:00
Tom Christie
8e4a8a1c73
Finesse URL properties (#1285)
* url.userinfo should be URL encoded bytes

* Neater copy_with implementation

* Finesse API around URL properties and copy_with

* Docstring for URL, and drop url.authority

* Support url.copy_with(raw_path=...)

* Docstrings on URL methods

* Tweak docstring
2020-09-21 11:35:25 +01:00
Florimond Manca
78cf16ace9
Drop HSTS Preloading (#1110)
* Drop HSTS Preloading

* Update test_client.py

Co-authored-by: Tom Christie <tom@tomchristie.com>
2020-08-05 13:05:45 +01:00
Taneli Hukkinen
8dea2c23d7
Make isort configuration compatible with isort v5 (#1050)
* Make isort configuration compatible with isort v5

* Use isort's black profile
2020-07-04 22:31:09 +01:00
Florimond Manca
66a4537959
Add mypy config for tests directory (#991) 2020-05-25 08:39:51 +02:00
Florimond Manca
9f58afd8f9
Tighten multipart implementation types (#975) 2020-05-21 17:41:36 +02:00
Tom Christie
0a8b0c65bd
Enforce coverage (#955)
* Enforce coverage when running tests

* Enforce test coverage
2020-05-15 16:17:33 +01:00
Tom Christie
3046e920ea
Httpcore interface (#804)
* First pass as switching dispatchers over to httpcore interface

* Updates for httpcore interface

* headers in dispatch API as plain list of bytes

* Integrate against httpcore 0.6

* Integrate against httpcore interface

* Drop UDS, since not supported by httpcore

* Fix base class for mock dispatchers in tests

* Merge master and mark as potential '0.13.dev0' release
2020-04-08 13:32:10 +01:00
Tom Christie
ae45c23cc5
Do not mark wheel as universal (#851) 2020-03-05 12:56:47 +00:00
Tom Christie
ee37a762ef
Reintroduce sync API. (#735)
* BaseClient and AsyncClient

* Introduce 'httpx.Client'

* Top level API -> sync

* Top level API -> sync

* Add WSGI support, drop deprecated imports

* Wire up timeouts to urllib3

* Wire up pool_limits

* Add urllib3 proxy support

* Pull #734 into sync Client

* Update AsyncClient docstring

* Simpler WSGI implementation

* Set body=None when no content

* Wrap urllib3 connection/read exceptions
2020-01-08 12:31:50 +00:00
Florimond Manca
9e88f2e2fb Remove httpxprof (#663) 2019-12-21 14:17:14 +00:00
Tom Christie
3cbe7315e8
Concurrency autodetection (#585)
* Simplify HTTP version config, and switch HTTP/2 off by default

* HTTP/2 docs

* HTTP/2 interlinking in docs

* Add concurrency auto-detection

* Add sniffio
2019-12-02 19:26:16 +00:00
Florimond Manca
8d55d78574 Drop nox in favor of vanilla scripts (#566)
* Drop nox in favor of vanilla scripts

* Use named stages

* Fix attrs dependency resolution madness

* Add missing mkautodoc dev dependency

* Add missing install step on windows build

* Explicitly define stage order so that timed out Windows build runs last

* Add missing dev dependency on Black

* Clean up contributing guide

* Separate docs into docs-build and docs-serve
2019-11-30 11:50:13 +00:00
Josep Cugat
9e1cc26f8a Build and upload universal wheels to PyPI (#439) 2019-10-03 16:35:38 -05:00
Florimond Manca
e1da6b9194 Add tool for profiling (#364) 2019-09-21 12:02:02 -05:00
Florimond Manca
08355c62f5 Add trio concurrency backend (#276) 2019-09-21 11:10:20 -05:00
Yeray Diaz Diaz
8155352d20
Document digest auth (#348)
* Document authentication

* Fix linting errors

* Tweak wording

* Update docs/quickstart.md

Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>
2019-09-16 12:50:00 +01:00
Florimond Manca
f1dde95d35
Test Requests entrypoints (#330)
* Test Requests entrypoints

* Show summary of unsuccessful tests
2019-09-12 23:24:33 +02:00
Florimond Manca
8ea32e647f Add tests to known first parties in isort config (#279) 2019-08-26 15:16:51 -05:00
Seth Michael Larson
46402dd59f
Rely on codecov for 100% project coverage (#264) 2019-08-23 07:00:13 -05:00
Can Sarıgöl
9536b76f5c Fail unit tests without 100% coverage (#206) 2019-08-14 21:45:28 -05:00
Humberto Rocha
e51b2125c9 Move all tooling configuration to setup.cfg (#204) 2019-08-13 16:27:00 -05:00