Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python: test with more modern versions #19452

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/samples-postman.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
# schema
- samples/schema/postman-collection
python-version:
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/samples-python-petstore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
sample:
- samples/openapi3/client/petstore/python-aiohttp
- samples/openapi3/client/petstore/python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
# clients
- samples/client/echo_api/python-pydantic-v1/
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/samples-python-pydantic-v1-petstore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
sample:
- samples/openapi3/client/petstore/python-pydantic-v1-aiohttp
- samples/openapi3/client/petstore/python-pydantic-v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-python-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.7'
python-version: '3.9'
- name: Test
working-directory: ${{ matrix.sample }}
run: make test-all
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,31 @@ import unittest
from {{apiPackage}}.{{classFilename}} import {{classname}} # noqa: E501


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

{{#asyncio}}
async def asyncSetUp(self) -> None:
self.api = {{classname}}()

async def asyncTearDown(self) -> None:
pass
{{/asyncio}}
{{^asyncio}}
def setUp(self) -> None:
self.api = {{classname}}() # noqa: E501
self.api = {{classname}}()

def tearDown(self) -> None:
pass
{{/asyncio}}

{{#operation}}
{{#operation}}
{{#asyncio}}
async def test_{{operationId}}(self) -> None:
{{/asyncio}}
{{^asyncio}}
def test_{{operationId}}(self) -> None:
{{/asyncio}}
"""Test case for {{{operationId}}}

{{#summary}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keywords = ["OpenAPI", "OpenAPI-Generator", "{{{appName}}}"]
include = ["{{packageName}}/py.typed"]

[tool.poetry.dependencies]
python = "^3.7"
python = "^3.8"

urllib3 = ">= 1.25.3"
python-dateutil = ">=2.8.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,31 @@ import unittest
from {{apiPackage}}.{{classFilename}} import {{classname}}


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

{{#asyncio}}
async def asyncSetUp(self) -> None:
self.api = {{classname}}()

async def asyncTearDown(self) -> None:
pass
{{/asyncio}}
{{^asyncio}}
def setUp(self) -> None:
self.api = {{classname}}()

def tearDown(self) -> None:
pass
{{/asyncio}}

{{#operation}}
{{#operation}}
{{#asyncio}}
async def test_{{operationId}}(self) -> None:
{{/asyncio}}
{{^asyncio}}
def test_{{operationId}}(self) -> None:
{{/asyncio}}
"""Test case for {{{operationId}}}

{{#summary}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keywords = ["OpenAPI", "OpenAPI-Generator", "{{{appName}}}"]
include = ["{{packageName}}/py.typed"]

[tool.poetry.dependencies]
python = "^3.7"
python = "^3.8"

urllib3 = ">= 1.25.3"
python-dateutil = ">=2.8.2"
Expand All @@ -33,7 +33,7 @@ pytest = ">=7.2.1"
tox = ">=3.9.0"
flake8 = ">=4.0.0"
types-python-dateutil = ">=2.8.19.14"
mypy = "1.4.1"
mypy = ">=1.5"


[build-system]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keywords = ["OpenAPI", "OpenAPI-Generator", "Echo Server API"]
include = ["openapi_client/py.typed"]

[tool.poetry.dependencies]
python = "^3.7"
python = "^3.8"

urllib3 = ">= 1.25.3"
python-dateutil = ">=2.8.2"
Expand All @@ -22,7 +22,7 @@ pytest = ">=7.2.1"
tox = ">=3.9.0"
flake8 = ">=4.0.0"
types-python-dateutil = ">=2.8.19.14"
mypy = "1.4.1"
mypy = ">=1.5"


[build-system]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion samples/client/echo_api/python-pydantic-v1/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keywords = ["OpenAPI", "OpenAPI-Generator", "Echo Server API"]
include = ["openapi_client/py.typed"]

[tool.poetry.dependencies]
python = "^3.7"
python = "^3.8"

urllib3 = ">= 1.25.3"
python-dateutil = ">=2.8.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions samples/client/echo_api/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keywords = ["OpenAPI", "OpenAPI-Generator", "Echo Server API"]
include = ["openapi_client/py.typed"]

[tool.poetry.dependencies]
python = "^3.7"
python = "^3.8"

urllib3 = ">= 1.25.3"
python-dateutil = ">=2.8.2"
Expand All @@ -22,7 +22,7 @@ pytest = ">=7.2.1"
tox = ">=3.9.0"
flake8 = ">=4.0.0"
types-python-dateutil = ">=2.8.19.14"
mypy = "1.4.1"
mypy = ">=1.5"


[build-system]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keywords = ["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"]
include = ["petstore_api/py.typed"]

[tool.poetry.dependencies]
python = "^3.7"
python = "^3.8"

urllib3 = ">= 1.25.3"
python-dateutil = ">=2.8.2"
Expand All @@ -26,7 +26,7 @@ pytest = ">=7.2.1"
tox = ">=3.9.0"
flake8 = ">=4.0.0"
types-python-dateutil = ">=2.8.19.14"
mypy = "1.4.1"
mypy = ">=1.5"


[build-system]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@
"""
OpenAPI Petstore

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\

The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
"""
""" # noqa: E501


import unittest
import datetime

import petstore_api
from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType # noqa: E501
from petstore_api.rest import ApiException
from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType

class TestAdditionalPropertiesAnyType(unittest.TestCase):
"""AdditionalPropertiesAnyType unit test stubs"""
Expand All @@ -28,19 +25,19 @@ def setUp(self):
def tearDown(self):
pass

def make_instance(self, include_optional):
def make_instance(self, include_optional) -> AdditionalPropertiesAnyType:
"""Test AdditionalPropertiesAnyType
include_option is a boolean, when False only required
include_optional is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `AdditionalPropertiesAnyType`
"""
model = petstore_api.models.additional_properties_any_type.AdditionalPropertiesAnyType() # noqa: E501
if include_optional :
model = AdditionalPropertiesAnyType()
if include_optional:
return AdditionalPropertiesAnyType(
name = ''
)
else :
else:
return AdditionalPropertiesAnyType(
)
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@
"""
OpenAPI Petstore

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\

The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
"""
""" # noqa: E501


import unittest
import datetime

import petstore_api
from petstore_api.models.additional_properties_class import AdditionalPropertiesClass # noqa: E501
from petstore_api.rest import ApiException
from petstore_api.models.additional_properties_class import AdditionalPropertiesClass

class TestAdditionalPropertiesClass(unittest.TestCase):
"""AdditionalPropertiesClass unit test stubs"""
Expand All @@ -28,26 +25,26 @@ def setUp(self):
def tearDown(self):
pass

def make_instance(self, include_optional):
def make_instance(self, include_optional) -> AdditionalPropertiesClass:
"""Test AdditionalPropertiesClass
include_option is a boolean, when False only required
include_optional is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `AdditionalPropertiesClass`
"""
model = petstore_api.models.additional_properties_class.AdditionalPropertiesClass() # noqa: E501
if include_optional :
model = AdditionalPropertiesClass()
if include_optional:
return AdditionalPropertiesClass(
map_property = {
'key' : ''
},
},
map_of_map_property = {
'key' : {
'key' : ''
}
}
)
else :
else:
return AdditionalPropertiesClass(
)
"""
Expand Down
Loading
Loading