From 0508b707811a85e8294afa4a14fedd6b9b66ba57 Mon Sep 17 00:00:00 2001 From: Keming Date: Wed, 3 May 2023 11:51:40 +0800 Subject: [PATCH] chore: clean test warnings (#308) * chore: clean test warnings Signed-off-by: Keming * make it compatible with py37 Signed-off-by: Keming * deprecate 3.7 test Signed-off-by: Keming --------- Signed-off-by: Keming --- .github/workflows/pythonpackage.yml | 4 ++-- pyproject.toml | 4 +--- tests/flask_imports/dry_plugin_flask.py | 6 +++--- tests/test_plugin_flask_blueprint.py | 1 - tests/test_plugin_starlette.py | 3 ++- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 2c8736c3..ddf8c1f0 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -33,9 +33,9 @@ jobs: runs-on: ${{ matrix.os }} needs: [lint] strategy: - max-parallel: 6 + max-parallel: 5 matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "pypy3.7"] + python-version: ["3.8", "3.9", "3.10", "3.11", "pypy3.8"] os: [ubuntu-latest] steps: diff --git a/pyproject.toml b/pyproject.toml index 0af85af6..a0a2aa73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ dynamic = [] description = "generate OpenAPI document and validate request&response with Python annotations." readme = "README.md" license = {text = "Apache-2.0"} -requires-python = ">=3.6" +requires-python = ">=3.8" authors = [ { name = "Keming Yang", email = "kemingy94@gmail.com" }, ] @@ -14,8 +14,6 @@ classifiers = [ "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", diff --git a/tests/flask_imports/dry_plugin_flask.py b/tests/flask_imports/dry_plugin_flask.py index 4745737e..3144a4fc 100644 --- a/tests/flask_imports/dry_plugin_flask.py +++ b/tests/flask_imports/dry_plugin_flask.py @@ -4,7 +4,7 @@ def test_flask_skip_validation(client): - client.set_cookie("flask", "pub", "abcdefg") + client.set_cookie(key="pub", value="abcdefg") resp = client.post( "/api/user_skip/flask?order=1", @@ -19,7 +19,7 @@ def test_flask_skip_validation(client): def test_flask_return_model(client): - client.set_cookie("flask", "pub", "abcdefg") + client.set_cookie(key="pub", value="abcdefg") resp = client.post( "/api/user_model/flask?order=1", @@ -121,7 +121,7 @@ def test_flask_validate_basic(client): ], ) def test_flask_validate_post_data(client, fragment): - client.set_cookie("flask", "pub", "abcdefg") + client.set_cookie(key="pub", value="abcdefg") resp = client.post( f"/api/{fragment}/flask?order=1", json=dict(name="flask", limit=10), diff --git a/tests/test_plugin_flask_blueprint.py b/tests/test_plugin_flask_blueprint.py index 799a4d61..619b567a 100644 --- a/tests/test_plugin_flask_blueprint.py +++ b/tests/test_plugin_flask_blueprint.py @@ -225,7 +225,6 @@ def ping(): with flask_app.app_context(): api.spec - api.register(app) with flask_app.test_client() as test_client: yield test_client, api diff --git a/tests/test_plugin_starlette.py b/tests/test_plugin_starlette.py index df4440a4..ad71313c 100644 --- a/tests/test_plugin_starlette.py +++ b/tests/test_plugin_starlette.py @@ -183,7 +183,6 @@ async def list_json(request): def inner_register_func(): - @app.route("/api/user/{name}/address/{address_id}") @api.validate( query=Query, path_parameter_descriptions={ @@ -194,6 +193,8 @@ def inner_register_func(): def user_address(request): return None + app.routes.append(Route("/api/user/{name}/address/{address_id}", user_address)) + inner_register_func() api.register(app)