Skip to content

Commit 6c96c19

Browse files
committed
python: test with more modern versions
Python 3.12 has been released in October 2023, it should be tested in the CI. Python 3.7 is not maintained anymore, removing it from the minimum required version in `pyproject.toml` files.
1 parent fb1c2f3 commit 6c96c19

File tree

228 files changed

+2359
-2287
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

228 files changed

+2359
-2287
lines changed

.github/workflows/samples-postman.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
# schema
1818
- samples/schema/postman-collection
1919
python-version:
20-
- "3.11"
20+
- "3.12"
2121
steps:
2222
- uses: actions/checkout@v4
2323
- uses: actions/setup-python@v5

.github/workflows/samples-python-petstore.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
- "3.9"
2020
- "3.10"
2121
- "3.11"
22+
- "3.12"
2223
sample:
2324
- samples/openapi3/client/petstore/python-aiohttp
2425
- samples/openapi3/client/petstore/python

.github/workflows/samples-python-pydantic-v1-client-echo-api.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
# clients
1818
- samples/client/echo_api/python-pydantic-v1/
1919
python-version:
20-
- "3.7"
2120
- "3.8"
2221
- "3.9"
2322
- "3.10"
2423
- "3.11"
24+
- "3.12"
2525
steps:
2626
- uses: actions/checkout@v4
2727
- uses: actions/setup-python@v5

.github/workflows/samples-python-pydantic-v1-petstore.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
- "3.9"
2020
- "3.10"
2121
- "3.11"
22+
- "3.12"
2223
sample:
2324
- samples/openapi3/client/petstore/python-pydantic-v1-aiohttp
2425
- samples/openapi3/client/petstore/python-pydantic-v1

.github/workflows/samples-python-server.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- uses: actions/checkout@v4
2222
- uses: actions/setup-python@v5
2323
with:
24-
python-version: '3.7'
24+
python-version: '3.9'
2525
- name: Test
2626
working-directory: ${{ matrix.sample }}
2727
run: make test-all

modules/openapi-generator/src/main/resources/python-pydantic-v1/api_test.mustache

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,31 @@ import unittest
77
from {{apiPackage}}.{{classFilename}} import {{classname}} # noqa: E501
88

99

10-
class {{#operations}}Test{{classname}}(unittest.TestCase):
10+
class {{#operations}}Test{{classname}}(unittest.{{#asyncio}}IsolatedAsyncio{{/asyncio}}TestCase):
1111
"""{{classname}} unit test stubs"""
1212

13+
{{#asyncio}}
14+
async def asyncSetUp(self) -> None:
15+
self.api = {{classname}}()
16+
17+
async def asyncTearDown(self) -> None:
18+
pass
19+
{{/asyncio}}
20+
{{^asyncio}}
1321
def setUp(self) -> None:
14-
self.api = {{classname}}() # noqa: E501
22+
self.api = {{classname}}()
1523

1624
def tearDown(self) -> None:
1725
pass
26+
{{/asyncio}}
1827

19-
{{#operation}}
28+
{{#operation}}
29+
{{#asyncio}}
30+
async def test_{{operationId}}(self) -> None:
31+
{{/asyncio}}
32+
{{^asyncio}}
2033
def test_{{operationId}}(self) -> None:
34+
{{/asyncio}}
2135
"""Test case for {{{operationId}}}
2236

2337
{{#summary}}

modules/openapi-generator/src/main/resources/python-pydantic-v1/github-workflow.mustache

Lines changed: 1 addition & 1 deletion
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.7", "3.8", "3.9", "3.10", "3.11"]
17+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1818

1919
steps:
2020
- uses: actions/checkout@v3

modules/openapi-generator/src/main/resources/python-pydantic-v1/pyproject.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ keywords = ["OpenAPI", "OpenAPI-Generator", "{{{appName}}}"]
1010
include = ["{{packageName}}/py.typed"]
1111

1212
[tool.poetry.dependencies]
13-
python = "^3.7"
13+
python = "^3.8"
1414

1515
urllib3 = ">= 1.25.3"
1616
python-dateutil = ">=2.8.2"

modules/openapi-generator/src/main/resources/python/api_test.mustache

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,31 @@ import unittest
77
from {{apiPackage}}.{{classFilename}} import {{classname}}
88

99

10-
class {{#operations}}Test{{classname}}(unittest.TestCase):
10+
class {{#operations}}Test{{classname}}(unittest.{{#asyncio}}IsolatedAsyncio{{/asyncio}}TestCase):
1111
"""{{classname}} unit test stubs"""
1212

13+
{{#asyncio}}
14+
async def asyncSetUp(self) -> None:
15+
self.api = {{classname}}()
16+
17+
async def asyncTearDown(self) -> None:
18+
pass
19+
{{/asyncio}}
20+
{{^asyncio}}
1321
def setUp(self) -> None:
1422
self.api = {{classname}}()
1523

1624
def tearDown(self) -> None:
1725
pass
26+
{{/asyncio}}
1827

19-
{{#operation}}
28+
{{#operation}}
29+
{{#asyncio}}
30+
async def test_{{operationId}}(self) -> None:
31+
{{/asyncio}}
32+
{{^asyncio}}
2033
def test_{{operationId}}(self) -> None:
34+
{{/asyncio}}
2135
"""Test case for {{{operationId}}}
2236

2337
{{#summary}}

modules/openapi-generator/src/main/resources/python/github-workflow.mustache

Lines changed: 1 addition & 1 deletion
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.7", "3.8", "3.9", "3.10", "3.11"]
17+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1818

1919
steps:
2020
- uses: actions/checkout@v3

0 commit comments

Comments
 (0)