Skip to content

Commit

Permalink
Resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
ahopkins committed Dec 31, 2023
2 parents 4dbc210 + a832cbc commit 6e632cc
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
pretty:
black --line-length 79 sanic_testing tests
isort --line-length 79 sanic_testing tests
install:
python -m venv venv
venv/bin/pip install --editable .[dev]
test:
venv/bin/pytest tests
1 change: 1 addition & 0 deletions requirements.testing.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
git+https://github.com/sanic-org/sanic.git
pytest
pytest-asyncio
setuptools
8 changes: 2 additions & 6 deletions sanic_testing/reusable.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ def _sanic_endpoint_test(

if gather_request:
_collect_request = partial(self._collect_request, request_data)
self.app.request_middleware.appendleft( # type: ignore
_collect_request
)
self.app.request_middleware.appendleft(_collect_request) # type: ignore # noqa

for route in self.app.router.routes:
if _collect_request not in route.extra.request_middleware:
Expand All @@ -137,9 +135,7 @@ def _sanic_endpoint_test(
)

try:
self.app.request_middleware.remove( # type: ignore
_collect_request
)
self.app.request_middleware.remove(_collect_request) # type: ignore # noqa
except BaseException: # noqa
pass

Expand Down
12 changes: 4 additions & 8 deletions sanic_testing/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,7 @@ def _sanic_endpoint_test(
self.app.signal_router.reset()

if gather_request:
self.app.request_middleware.appendleft( # type: ignore
_collect_request
)
self.app.request_middleware.appendleft(_collect_request) # type: ignore # noqa

try:
self.app.exception(MethodNotSupported)(self._error_handler)
Expand Down Expand Up @@ -246,9 +244,7 @@ def _sanic_endpoint_test(

if gather_request:
try:
self.app.request_middleware.remove( # type: ignore
_collect_request
)
self.app.request_middleware.remove(_collect_request) # type: ignore # noqa
except BaseException: # noqa
pass

Expand Down Expand Up @@ -388,8 +384,8 @@ async def request( # type: ignore
url = f"{scheme}://{ASGI_HOST}:{ASGI_PORT}{url}"

if self._collect_request not in self.sanic_app.request_middleware:
self.sanic_app.request_middleware.appendleft( # type: ignore
self._collect_request
self.sanic_app.request_middleware.appendleft(
self._collect_request # type: ignore
)

self.gather_request = gather_request
Expand Down
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,19 @@ def open_local(paths, mode="r", encoding="utf8"):
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
}
requirements = ["httpx>=0.18"]

tests_require = ["pytest", "sanic>=22.12", "pytest-asyncio"]
tests_require = [
"pytest", "sanic>=22.12", "pytest-asyncio",
"setuptools;python_version>'3.11'"
]

setup_kwargs["install_requires"] = requirements
setup_kwargs["tests_require"] = tests_require
setup_kwargs["extras_require"] = {
'dev': tests_require
}
setup(**setup_kwargs)
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[tox]
envlist = py38, py39, py310, py311, check
envlist = py38, py39, py310, py311, py312, check

[gh-actions]
python =
3.8: py38, check
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[testenv]
deps =
Expand Down

0 comments on commit 6e632cc

Please sign in to comment.