Skip to content

Commit d686bc5

Browse files
committed
LITE-30282: Support pytest-httpx >=0.27.0, drop Python 3.8 compatibility, add Python 3.12 to test matrix
1 parent f8423e3 commit d686bc5

File tree

8 files changed

+437
-515
lines changed

8 files changed

+437
-515
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: ['3.8', '3.9', '3.10', '3.11']
17+
python-version: ['3.9', '3.10', '3.11', '3.12']
1818
steps:
1919
- name: Checkout
2020
uses: actions/checkout@v3

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ play with the CloudBlue Connect API using a python REPL like [jupyter](https://j
1717

1818
## Install
1919

20-
`Connect Python OpenAPI Client` requires python 3.8 or later.
20+
`Connect Python OpenAPI Client` requires python 3.9 or later.
2121

2222

2323
`Connect Python OpenAPI Client` can be installed from [pypi.org](https://pypi.org/project/connect-openapi-client/) using pip:

connect/client/testing/fluent.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import responses
1111
from pytest import MonkeyPatch
1212
from pytest_httpx import HTTPXMock
13-
from pytest_httpx._httpx_mock import _PytestAsyncTransport
1413
from responses import matchers
1514

1615
from connect.client.fluent import _ConnectClientBase
@@ -176,20 +175,22 @@ def __init__(self, base_url, exclude=None):
176175

177176
def start(self):
178177
patterns = self.exclude if isinstance(self.exclude, (list, tuple, set)) else [self.exclude]
179-
real_async_transport = httpx.AsyncClient._transport_for_url
178+
real_handle_async_request = httpx.AsyncHTTPTransport.handle_async_request
180179

181-
def transport_for_url(self, url):
180+
async def mocked_handle_async_request(
181+
transport: httpx.AsyncHTTPTransport, request: httpx.Request
182+
) -> httpx.Response:
182183
for pattern in patterns:
183-
if (isinstance(pattern, re.Pattern) and pattern.match(str(url))) or (
184-
isinstance(pattern, str) and str(url).startswith(pattern)
184+
if (isinstance(pattern, re.Pattern) and pattern.match(str(request.url))) or (
185+
isinstance(pattern, str) and str(request.url).startswith(pattern)
185186
):
186-
return real_async_transport(self, url)
187-
return _PytestAsyncTransport(_async_mocker)
187+
return await real_handle_async_request(transport, request)
188+
return await _async_mocker._handle_async_request(transport, request)
188189

189190
_monkeypatch.setattr(
190-
httpx.AsyncClient,
191-
'_transport_for_url',
192-
transport_for_url,
191+
httpx.AsyncHTTPTransport,
192+
"handle_async_request",
193+
mocked_handle_async_request,
193194
)
194195

195196
def reset(self, success=True):

poetry.lock

+361-438
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "connect-openapi-client"
3-
version = "25.16"
3+
version = "29.4"
44
description = "Connect Python OpenAPI Client"
55
authors = ["CloudBlue"]
66
license = "Apache-2.0"
@@ -17,9 +17,10 @@ classifiers = [
1717
"Environment :: Console",
1818
"Operating System :: OS Independent",
1919
"Intended Audience :: Developers",
20-
"Programming Language :: Python :: 3.8",
2120
"Programming Language :: Python :: 3.9",
2221
"Programming Language :: Python :: 3.10",
22+
"Programming Language :: Python :: 3.11",
23+
"Programming Language :: Python :: 3.12",
2324
"Topic :: Utilities",
2425
"Topic :: Software Development :: Libraries",
2526
]
@@ -34,32 +35,32 @@ keywords = [
3435
]
3536

3637
[tool.poetry.dependencies]
37-
python = ">=3.8,<4"
38+
python = ">=3.9,<4"
3839
connect-markdown-renderer = "^3"
3940
PyYAML = ">=5.3.1"
4041
requests = ">=2.23"
4142
inflect = ">=4.1"
4243
httpx = ">=0.23"
4344
asgiref = "^3.3.4"
4445
responses = ">=0.14.0,<1"
45-
pytest-httpx = ">=0.20,<0.27"
46+
pytest-httpx = ">=0.27"
4647
importlib-metadata = "^6.6"
47-
urllib3 = "<2"
4848

4949
[tool.poetry.group.test.dependencies]
5050
black = "23.*"
5151
pytest = ">=6.1.2,<8"
5252
pytest-cov = ">=2.10.1,<5"
5353
pytest-mock = "^3.10"
5454
coverage = {extras = ["toml"], version = ">=5.3,<7"}
55-
flake8 = ">=3.8,<6"
55+
flake8 = ">=6"
5656
flake8-black = "0.*"
5757
flake8-bugbear = ">=20,<23"
5858
flake8-cognitive-complexity = "^0.1"
59-
flake8-commas = "~2.1"
59+
flake8-commas = "~4"
6060
flake8-future-import = "~0.4"
61+
flake8-import-order = ">=0.18.2"
6162
flake8-isort = "^6.0"
62-
flake8-broken-line = ">=0.3,<0.7"
63+
flake8-broken-line = ">=1.0"
6364
flake8-pyproject = "^1.2.3"
6465
isort = "^5.10"
6566
pytest-asyncio = "^0.15.1"

requirements/docs.txt

+54-55
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,54 @@
1-
annotated-types==0.5.0 ; python_version >= "3.8" and python_version < "4"
2-
anyio==4.0.0 ; python_version >= "3.8" and python_version < "4"
3-
asgiref==3.7.2 ; python_version >= "3.8" and python_version < "4"
4-
certifi==2023.7.22 ; python_version >= "3.8" and python_version < "4"
5-
charset-normalizer==3.2.0 ; python_version >= "3.8" and python_version < "4"
6-
click==8.1.7 ; python_version >= "3.8" and python_version < "4"
7-
colorama==0.4.6 ; python_version >= "3.8" and python_version < "4"
8-
commonmark==0.9.1 ; python_version >= "3.8" and python_version < "4"
9-
connect-markdown-renderer==3.0.0 ; python_version >= "3.8" and python_version < "4"
10-
exceptiongroup==1.1.3 ; python_version >= "3.8" and python_version < "3.11"
11-
ghp-import==2.1.0 ; python_version >= "3.8" and python_version < "4"
12-
griffe==0.36.2 ; python_version >= "3.8" and python_version < "4"
13-
h11==0.14.0 ; python_version >= "3.8" and python_version < "4"
14-
httpcore==0.17.3 ; python_version >= "3.8" and python_version < "4"
15-
httpx==0.24.1 ; python_version >= "3.8" and python_version < "4"
16-
idna==3.4 ; python_version >= "3.8" and python_version < "4"
17-
importlib-metadata==6.8.0 ; python_version >= "3.8" and python_version < "4"
18-
inflect==7.0.0 ; python_version >= "3.8" and python_version < "4"
19-
iniconfig==2.0.0 ; python_version >= "3.8" and python_version < "4"
20-
jinja2==3.1.2 ; python_version >= "3.8" and python_version < "4"
21-
markdown-it-py==2.2.0 ; python_version >= "3.8" and python_version < "4"
22-
markdown==3.4.4 ; python_version >= "3.8" and python_version < "4"
23-
markupsafe==2.1.3 ; python_version >= "3.8" and python_version < "4"
24-
mdurl==0.1.2 ; python_version >= "3.8" and python_version < "4"
25-
mergedeep==1.3.4 ; python_version >= "3.8" and python_version < "4"
26-
mkdocs-autorefs==0.5.0 ; python_version >= "3.8" and python_version < "4"
27-
mkdocs-material-extensions==1.1.1 ; python_version >= "3.8" and python_version < "4"
28-
mkdocs-material==8.5.11 ; python_version >= "3.8" and python_version < "4"
29-
mkdocs==1.5.2 ; python_version >= "3.8" and python_version < "4"
30-
mkdocstrings-python==0.8.3 ; python_version >= "3.8" and python_version < "4"
31-
mkdocstrings==0.20.0 ; python_version >= "3.8" and python_version < "4"
32-
packaging==23.1 ; python_version >= "3.8" and python_version < "4"
33-
pathspec==0.11.2 ; python_version >= "3.8" and python_version < "4"
34-
platformdirs==3.10.0 ; python_version >= "3.8" and python_version < "4"
35-
pluggy==1.3.0 ; python_version >= "3.8" and python_version < "4"
36-
pydantic-core==2.6.3 ; python_version >= "3.8" and python_version < "4"
37-
pydantic==2.3.0 ; python_version >= "3.8" and python_version < "4"
38-
pygments==2.16.1 ; python_version >= "3.8" and python_version < "4"
39-
pymdown-extensions==10.3 ; python_version >= "3.8" and python_version < "4"
40-
pytest-httpx==0.22.0 ; python_version >= "3.8" and python_version < "4"
41-
pytest==7.4.2 ; python_version >= "3.8" and python_version < "4"
42-
python-dateutil==2.8.2 ; python_version >= "3.8" and python_version < "4"
43-
pyyaml-env-tag==0.1 ; python_version >= "3.8" and python_version < "4"
44-
pyyaml==6.0.1 ; python_version >= "3.8" and python_version < "4"
45-
requests==2.31.0 ; python_version >= "3.8" and python_version < "4"
46-
responses==0.23.3 ; python_version >= "3.8" and python_version < "4"
47-
rich==12.6.0 ; python_version >= "3.8" and python_version < "4"
48-
six==1.16.0 ; python_version >= "3.8" and python_version < "4"
49-
sniffio==1.3.0 ; python_version >= "3.8" and python_version < "4"
50-
tomli==2.0.1 ; python_version >= "3.8" and python_version < "3.11"
51-
types-pyyaml==6.0.12.11 ; python_version >= "3.8" and python_version < "4"
52-
typing-extensions==4.8.0 ; python_version >= "3.8" and python_version < "4"
53-
urllib3==1.26.16 ; python_version >= "3.8" and python_version < "4"
54-
watchdog==3.0.0 ; python_version >= "3.8" and python_version < "4"
55-
zipp==3.16.2 ; python_version >= "3.8" and python_version < "4"
1+
anyio==4.4.0 ; python_version >= "3.9" and python_version < "4"
2+
asgiref==3.8.1 ; python_version >= "3.9" and python_version < "4"
3+
certifi==2024.6.2 ; python_version >= "3.9" and python_version < "4"
4+
charset-normalizer==3.3.2 ; python_version >= "3.9" and python_version < "4"
5+
click==8.1.7 ; python_version >= "3.9" and python_version < "4"
6+
colorama==0.4.6 ; python_version >= "3.9" and python_version < "4"
7+
commonmark==0.9.1 ; python_version >= "3.9" and python_version < "4"
8+
connect-markdown-renderer==3.0.0 ; python_version >= "3.9" and python_version < "4"
9+
exceptiongroup==1.2.1 ; python_version >= "3.9" and python_version < "3.11"
10+
ghp-import==2.1.0 ; python_version >= "3.9" and python_version < "4"
11+
griffe==0.45.2 ; python_version >= "3.9" and python_version < "4"
12+
h11==0.14.0 ; python_version >= "3.9" and python_version < "4"
13+
httpcore==1.0.5 ; python_version >= "3.9" and python_version < "4"
14+
httpx==0.27.0 ; python_version >= "3.9" and python_version < "4"
15+
idna==3.7 ; python_version >= "3.9" and python_version < "4"
16+
importlib-metadata==6.11.0 ; python_version >= "3.9" and python_version < "4"
17+
inflect==7.2.1 ; python_version >= "3.9" and python_version < "4"
18+
iniconfig==2.0.0 ; python_version >= "3.9" and python_version < "4"
19+
jinja2==3.1.4 ; python_version >= "3.9" and python_version < "4"
20+
markdown-it-py==2.2.0 ; python_version >= "3.9" and python_version < "4"
21+
markdown==3.6 ; python_version >= "3.9" and python_version < "4"
22+
markupsafe==2.1.5 ; python_version >= "3.9" and python_version < "4"
23+
mdurl==0.1.2 ; python_version >= "3.9" and python_version < "4"
24+
mergedeep==1.3.4 ; python_version >= "3.9" and python_version < "4"
25+
mkdocs-autorefs==1.0.1 ; python_version >= "3.9" and python_version < "4"
26+
mkdocs-get-deps==0.2.0 ; python_version >= "3.9" and python_version < "4"
27+
mkdocs-material-extensions==1.3.1 ; python_version >= "3.9" and python_version < "4"
28+
mkdocs-material==8.5.11 ; python_version >= "3.9" and python_version < "4"
29+
mkdocs==1.6.0 ; python_version >= "3.9" and python_version < "4"
30+
mkdocstrings-python==0.8.3 ; python_version >= "3.9" and python_version < "4"
31+
mkdocstrings==0.20.0 ; python_version >= "3.9" and python_version < "4"
32+
more-itertools==10.2.0 ; python_version >= "3.9" and python_version < "4"
33+
packaging==24.0 ; python_version >= "3.9" and python_version < "4"
34+
pathspec==0.12.1 ; python_version >= "3.9" and python_version < "4"
35+
platformdirs==4.2.2 ; python_version >= "3.9" and python_version < "4"
36+
pluggy==1.5.0 ; python_version >= "3.9" and python_version < "4"
37+
pygments==2.18.0 ; python_version >= "3.9" and python_version < "4"
38+
pymdown-extensions==10.8.1 ; python_version >= "3.9" and python_version < "4"
39+
pytest-httpx==0.30.0 ; python_version >= "3.9" and python_version < "4"
40+
pytest==7.4.4 ; python_version >= "3.9" and python_version < "4"
41+
python-dateutil==2.9.0.post0 ; python_version >= "3.9" and python_version < "4"
42+
pyyaml-env-tag==0.1 ; python_version >= "3.9" and python_version < "4"
43+
pyyaml==6.0.1 ; python_version >= "3.9" and python_version < "4"
44+
requests==2.32.3 ; python_version >= "3.9" and python_version < "4"
45+
responses==0.25.0 ; python_version >= "3.9" and python_version < "4"
46+
rich==12.6.0 ; python_version >= "3.9" and python_version < "4"
47+
six==1.16.0 ; python_version >= "3.9" and python_version < "4"
48+
sniffio==1.3.1 ; python_version >= "3.9" and python_version < "4"
49+
tomli==2.0.1 ; python_version >= "3.9" and python_version < "3.11"
50+
typeguard==4.3.0 ; python_version >= "3.9" and python_version < "4"
51+
typing-extensions==4.12.1 ; python_version >= "3.9" and python_version < "4"
52+
urllib3==1.26.18 ; python_version >= "3.9" and python_version < "4"
53+
watchdog==4.0.1 ; python_version >= "3.9" and python_version < "4"
54+
zipp==3.19.1 ; python_version >= "3.9" and python_version < "4"

tests/async_client/test_fluent.py

-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,6 @@ async def test_execute_delete(httpx_mock):
368368
httpx_mock.add_response(
369369
method='DELETE',
370370
url='https://localhost/resources',
371-
text='error text',
372371
status_code=204,
373372
)
374373

tests/client/test_fluent.py

-1
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,6 @@ def test_execute_delete(mocked_responses):
487487
mocked_responses.add(
488488
responses.DELETE,
489489
'https://localhost/resources',
490-
body='error text',
491490
status=204,
492491
)
493492

0 commit comments

Comments
 (0)