Skip to content

Commit e6410bb

Browse files
committed
build: fix tox
1 parent bd2f8a8 commit e6410bb

8 files changed

Lines changed: 595 additions & 364 deletions

File tree

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@ repos:
3030
- id: check-yaml
3131
exclude: ^recipes/.*
3232
repo: https://github.com/pre-commit/pre-commit-hooks
33-
rev: v4.3.0
33+
rev: v6.0.0
3434

3535
# --- Commit msg checks ---
3636
- hooks:
3737
- id: commitizen
3838
stages: ["commit-msg"]
3939
repo: https://github.com/commitizen-tools/commitizen
40-
rev: v2.27.1
40+
rev: v4.13.7
4141

4242
# --- Strip output from .ipynb files ---
4343
- hooks:
4444
- id: nbstripout
4545
files: ".ipynb"
4646
repo: https://github.com/kynan/nbstripout
47-
rev: 0.5.0
47+
rev: 0.9.0
4848

4949
# --- Linters ---
5050
- hooks:
@@ -54,8 +54,8 @@ repos:
5454
- hooks:
5555
- id: black
5656
repo: https://github.com/psf/black
57-
rev: 22.3.0
57+
rev: 26.1.0
5858
- repo: https://github.com/pre-commit/mirrors-prettier
5959
hooks:
6060
- id: prettier
61-
rev: v2.7.1
61+
rev: v4.0.0-alpha.8

authcaptureproxy/__init__.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
# SPDX-License-Identifier: Apache-2.0
22
"""Metadata for this auth_capture_proxy."""
3-
import logging
4-
5-
try:
6-
from importlib_metadata import PackageNotFoundError
7-
from importlib_metadata import metadata as __load
8-
except ModuleNotFoundError:
9-
from importlib.metadata import PackageNotFoundError # type: ignore
10-
from importlib.metadata import metadata as __load # type: ignore
113

12-
# If you need to support Python 3.7, change to importlib_metadata (underscore, not dot)
13-
# and then list importlib_metadata to [tool.poetry.dependencies] and docs/requirements.txt
4+
import logging
5+
from importlib.metadata import PackageNotFoundError
6+
from importlib.metadata import metadata as __load
147
from pathlib import Path
158

169
from authcaptureproxy import const

authcaptureproxy/helper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
Helper files.
66
"""
7+
78
import ast
89
import json
910
import logging
@@ -150,7 +151,7 @@ def swap_url(
150151
url = URL(url)
151152
old_url_string: Text = str(old_url.with_query({}))
152153
new_url_string: Text = str(new_url.with_query({}))
153-
old_query: MultiDict = url.query
154+
old_query: MultiDictProxy = url.query
154155
url_string = str(url.with_query({}))
155156
# ensure both paths end with "/" if one of them does
156157
if (
@@ -220,7 +221,7 @@ def replace_empty_url(new_url: URL, url: URL) -> URL:
220221

221222

222223
def get_nested_dict_keys(
223-
nested_dict: Mapping[Text, Union[Callable, Dict[Text, Callable]]]
224+
nested_dict: Mapping[Text, Union[Callable, Dict[Text, Callable]]],
224225
) -> List[Text]:
225226
"""Get list of nested dict keys.
226227

docs/conf.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,16 @@ def find(key: str, default: Optional[Any] = None, as_type: Type[Any] = str) -> O
3636
# Basic information, used by Sphinx
3737
# Leave language as None unless you have multiple translations
3838
language = None
39-
project = str(find("tool.poetry.name", default=""))
40-
version = find("tool.poetry.version", default="")
39+
project = str(find("project.name", default=""))
40+
version = find("project.version", default="")
4141
release = version
42-
author = ", ".join(find("tool.poetry.authors", default="", as_type=list)) # type: ignore
42+
authors = find("project.authors", default=[], as_type=list)
43+
if isinstance(authors, list) and len(authors) > 0 and isinstance(authors[0], dict):
44+
author = ", ".join(str(a.get("name", "")) for a in authors)
45+
elif isinstance(authors, list):
46+
author = ", ".join(str(a) for a in authors)
47+
else:
48+
author = ""
4349

4450
# Copyright string (for documentation)
4551
# It's not clear whether we're supposed to, but we'll add the license

poetry.lock

Lines changed: 561 additions & 338 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ authors = [
1313
maintainers = [
1414
{ name = "Alan D. Tse", email = "alandtse@gmail.com" }
1515
]
16-
license = { text = "Apache-2.0" }
16+
license = "Apache-2.0"
1717
classifiers = [
1818
"Development Status :: 3 - Alpha",
1919
"Natural Language :: English",

tests/test_regression_headers_and_json_parsing.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ async def post(self, url: str, **kwargs):
3232
}
3333
)
3434
req = httpx.Request("POST", url)
35-
return httpx.Response(
36-
200, request=req, text="ok", headers={"Content-Type": "text/plain"}
37-
)
35+
return httpx.Response(200, request=req, text="ok", headers={"Content-Type": "text/plain"})
3836

3937

4038
async def _make_request(
@@ -57,12 +55,18 @@ async def _make_request(
5755

5856
loop = asyncio.get_running_loop()
5957

58+
class MockProtocol(asyncio.BaseProtocol):
59+
def __init__(self):
60+
self._reading_paused = False
61+
62+
protocol = MockProtocol()
63+
6064
# aiohttp 3.9: StreamReader(protocol, limit, loop)
6165
# newer aiohttp: signature varies; keep this compatible.
6266
try:
63-
payload = StreamReader(None, 2**16, loop=loop) # type: ignore[arg-type]
67+
payload = StreamReader(protocol, 2**16, loop=loop) # type: ignore[arg-type]
6468
except TypeError:
65-
payload = StreamReader(protocol=None, limit=2**16, loop=loop) # type: ignore[arg-type]
69+
payload = StreamReader(protocol=protocol, limit=2**16, loop=loop) # type: ignore[arg-type]
6670

6771
if body:
6872
payload.feed_data(body)

tox.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ commands =
3939
poetry run pytest tests/
4040

4141
[testenv:cov]
42+
basepython = python3.10
4243
commands =
4344
poetry run pytest --cov-report term-missing --cov=authcaptureproxy --cov-report=xml:cov.xml tests/
4445

4546
[testenv:lint]
47+
basepython = python3.10
4648
commands =
4749
poetry run isort authcaptureproxy
4850
poetry run black authcaptureproxy
@@ -56,12 +58,14 @@ commands =
5658
poetry run flake8 --ignore=D100,D101,D102,D103,D104,S101,W503,E203,E225,E301,E302,E501,D107,D200,D205,D400,D403,D409,D410,D411,D212,W391,W293 tests
5759

5860
[testenv:typing]
61+
basepython = python3.10
5962
commands =
6063
poetry run mypy --show-error-codes authcaptureproxy
6164
poetry run mypy --show-error-codes docs
6265
poetry run mypy --show-error-codes tests
6366

6467
[testenv:docs]
68+
basepython = python3.10
6569
commands =
6670
poetry run sphinx-build -b html docs docs/html
6771

0 commit comments

Comments
 (0)