Skip to content

Commit

Permalink
Merge pull request #130 from Colin-b/develop
Browse files Browse the repository at this point in the history
Release 0.28.0
  • Loading branch information
Colin-b authored Dec 21, 2023
2 parents 55914bc + ef6fc63 commit 0abf1eb
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
pytest --cov=pytest_httpx --cov-fail-under=100 --cov-report=term-missing --runpytest=subprocess
- name: Create packages
run: |
python -m pip install wheel
python -m pip install wheel setuptools
python setup.py sdist bdist_wheel
- name: Publish packages
run: |
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ jobs:
python -m pip install -e .[testing]
- name: Test
run: |
pytest --cov=pytest_httpx --cov-fail-under=100 --cov-report=term-missing --runpytest=subprocess
pytest --cov=pytest_httpx --cov-fail-under=100 --cov-report=term-missing --runpytest=subprocess
- name: Test packages creation
run: |
python -m pip install wheel setuptools
python setup.py sdist bdist_wheel
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
repos:
- repo: https://github.com/psf/black
rev: 23.11.0
rev: 23.12.0
hooks:
- id: black
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.28.0] - 2023-12-21
### Changed
- Requires [`httpx`](https://www.python-httpx.org)==0.26.\*

## [0.27.0] - 2023-11-13
### Added
- Explicit support for python `3.12`.
Expand Down Expand Up @@ -297,7 +301,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- First release, should be considered as unstable for now as design might change.

[Unreleased]: https://github.com/Colin-b/pytest_httpx/compare/v0.27.0...HEAD
[Unreleased]: https://github.com/Colin-b/pytest_httpx/compare/v0.28.0...HEAD
[0.28.0]: https://github.com/Colin-b/pytest_httpx/compare/v0.27.0...v0.28.0
[0.27.0]: https://github.com/Colin-b/pytest_httpx/compare/v0.26.0...v0.27.0
[0.26.0]: https://github.com/Colin-b/pytest_httpx/compare/v0.25.0...v0.26.0
[0.25.0]: https://github.com/Colin-b/pytest_httpx/compare/v0.24.0...v0.25.0
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ from pytest_httpx import HTTPXMock


def test_proxy_url(httpx_mock: HTTPXMock):
httpx_mock.add_response(proxy_url="http://test_proxy_url?a=1&b=2")
httpx_mock.add_response(proxy_url="http://test_proxy_url?b=1&a=2")

with httpx.Client(proxies={"https://": "http://test_proxy_url?a=2&b=1"}) as client:
with httpx.Client(proxy="http://test_proxy_url?a=2&b=1") as client:
response = client.get("https://test_url")
```

Expand Down
2 changes: 1 addition & 1 deletion pytest_httpx/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# Major should be incremented in case there is a breaking change. (eg: 2.5.8 -> 3.0.0)
# Minor should be incremented in case there is an enhancement. (eg: 2.5.8 -> 2.6.0)
# Patch should be incremented in case there is a bug fix. (eg: 2.5.8 -> 2.5.9)
__version__ = "0.27.0"
__version__ = "0.28.0"
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
packages=find_packages(exclude=["tests*"]),
package_data={"pytest_httpx": ["py.typed"]},
entry_points={"pytest11": ["pytest_httpx = pytest_httpx"]},
install_requires=["httpx==0.25.*", "pytest==7.*"],
install_requires=["httpx==0.26.*", "pytest==7.*"],
extras_require={
"testing": [
# Used to run async test functions
"pytest-asyncio==0.21.*",
"pytest-asyncio==0.23.*",
# Used to check coverage
"pytest-cov==4.*",
]
Expand Down
30 changes: 12 additions & 18 deletions tests/test_httpx_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -1233,12 +1233,7 @@ async def test_content_matching(httpx_mock: HTTPXMock) -> None:
async def test_proxy_matching(httpx_mock: HTTPXMock) -> None:
httpx_mock.add_response(proxy_url="http://user:pwd@my_other_proxy/")

async with httpx.AsyncClient(
proxies={
"http://": "http://my_test_proxy",
"https://": "http://user:pwd@my_other_proxy",
}
) as client:
async with httpx.AsyncClient(proxy="http://user:pwd@my_other_proxy") as client:
response = await client.get("https://test_url")
assert response.read() == b""

Expand All @@ -1247,12 +1242,7 @@ async def test_proxy_matching(httpx_mock: HTTPXMock) -> None:
async def test_proxy_not_matching(httpx_mock: HTTPXMock) -> None:
httpx_mock.add_response(proxy_url="http://my_test_proxy")

async with httpx.AsyncClient(
proxies={
"http://": "http://my_test_proxy",
"https://": "http://user:pwd@my_other_proxy",
}
) as client:
async with httpx.AsyncClient(proxy="http://my_test_proxy") as client:
with pytest.raises(httpx.TimeoutException) as exception_info:
await client.get("http://test_url")
assert (
Expand Down Expand Up @@ -1311,9 +1301,11 @@ async def test_requests_retrieval_proxy_matching(httpx_mock: HTTPXMock) -> None:
httpx_mock.add_response()

async with httpx.AsyncClient(
proxies={
"http://": "http://my_test_proxy",
"https://": "http://user:pwd@my_other_proxy",
mounts={
"http://": httpx.AsyncHTTPTransport(proxy="http://my_test_proxy"),
"https://": httpx.AsyncHTTPTransport(
proxy="http://user:pwd@my_other_proxy"
),
}
) as client:
await client.get("https://test_url")
Expand All @@ -1330,9 +1322,11 @@ async def test_request_retrieval_proxy_matching(httpx_mock: HTTPXMock) -> None:
httpx_mock.add_response()

async with httpx.AsyncClient(
proxies={
"http://": "http://my_test_proxy",
"https://": "http://user:pwd@my_other_proxy",
mounts={
"http://": httpx.AsyncHTTPTransport(proxy="http://my_test_proxy"),
"https://": httpx.AsyncHTTPTransport(
proxy="http://user:pwd@my_other_proxy"
),
}
) as client:
await client.get("https://test_url")
Expand Down
26 changes: 8 additions & 18 deletions tests/test_httpx_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,25 +979,15 @@ def test_content_matching(httpx_mock: HTTPXMock) -> None:
def test_proxy_matching(httpx_mock: HTTPXMock) -> None:
httpx_mock.add_response(proxy_url="http://user:pwd@my_other_proxy/")

with httpx.Client(
proxies={
"http://": "http://my_test_proxy",
"https://": "http://user:pwd@my_other_proxy",
}
) as client:
with httpx.Client(proxy="http://user:pwd@my_other_proxy") as client:
response = client.get("https://test_url")
assert response.read() == b""


def test_proxy_not_matching(httpx_mock: HTTPXMock) -> None:
httpx_mock.add_response(proxy_url="http://my_test_proxy")

with httpx.Client(
proxies={
"http://": "http://my_test_proxy",
"https://": "http://user:pwd@my_other_proxy",
}
) as client:
with httpx.Client(proxy="http://my_test_proxy") as client:
with pytest.raises(httpx.TimeoutException) as exception_info:
client.get("http://test_url")
assert (
Expand Down Expand Up @@ -1052,9 +1042,9 @@ def test_requests_retrieval_proxy_matching(httpx_mock: HTTPXMock) -> None:
httpx_mock.add_response()

with httpx.Client(
proxies={
"http://": "http://my_test_proxy",
"https://": "http://user:pwd@my_other_proxy",
mounts={
"http://": httpx.HTTPTransport(proxy="http://my_test_proxy"),
"https://": httpx.HTTPTransport(proxy="http://user:pwd@my_other_proxy"),
}
) as client:
client.get("https://test_url")
Expand All @@ -1070,9 +1060,9 @@ def test_request_retrieval_proxy_matching(httpx_mock: HTTPXMock) -> None:
httpx_mock.add_response()

with httpx.Client(
proxies={
"http://": "http://my_test_proxy",
"https://": "http://user:pwd@my_other_proxy",
mounts={
"http://": httpx.HTTPTransport(proxy="http://my_test_proxy"),
"https://": httpx.HTTPTransport(proxy="http://user:pwd@my_other_proxy"),
}
) as client:
client.get("https://test_url")
Expand Down

0 comments on commit 0abf1eb

Please sign in to comment.