Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit 9b1c56f

Browse files
authored
Adds python 3.9 CI testing, fixes bug (#227)
* Adds py39 ci run * Removes envlist from tox files * Samples regen * Samples regen
1 parent 6c88e1f commit 9b1c56f

File tree

13 files changed

+39
-56
lines changed

13 files changed

+39
-56
lines changed

.circleci/config.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ jobs:
122122
steps:
123123
- command_build_and_test:
124124
jobId: "mvnCleanInstall"
125-
testPythonClientSamples:
125+
testPython38ClientSamples:
126126
docker:
127127
- image: python:3.8
128128
working_directory: ~/OpenAPITools/openapi-json-schema-generator
@@ -134,10 +134,23 @@ jobs:
134134
- checkout
135135
- command_docker_build_and_test:
136136
jobId: "testPythonClientSamples"
137+
testPython39ClientSamples:
138+
docker:
139+
- image: python:3.9
140+
working_directory: ~/OpenAPITools/openapi-json-schema-generator
141+
shell: /bin/bash --login
142+
environment:
143+
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
144+
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
145+
steps:
146+
- checkout
147+
- command_docker_build_and_test:
148+
jobId: "testPythonClientSamples"
137149
workflows:
138150
version: 2
139151
build:
140152
jobs:
141153
- ensureSamplesAndGeneratorDocsUpToDate
142154
- mvnCleanInstall
143-
- testPythonClientSamples
155+
- testPython38ClientSamples
156+
- testPython39ClientSamples

samples/client/3_0_3_unit_test/python/src/unit_test_api/schemas/validation.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,7 @@
2424

2525
from . import format, original_immutabledict
2626

27-
_K = typing.TypeVar('_K')
28-
_V = typing.TypeVar('_V', covariant=True)
29-
30-
31-
class immutabledict(typing.Generic[_K, _V], original_immutabledict.immutabledict[_K, _V]):
32-
# this class layer needed to not show init signature when making new instances
33-
pass
27+
immutabledict = original_immutabledict.immutabledict
3428

3529

3630
@dataclasses.dataclass
@@ -172,7 +166,9 @@ def _get_class(
172166
elif isinstance(item_cls, type):
173167
return item_cls
174168
elif isinstance(item_cls, typing.ForwardRef):
175-
return item_cls._evaluate(None, local_namespace)
169+
if sys.version_info < (3, 9):
170+
return item_cls._evaluate(None, local_namespace)
171+
return item_cls._evaluate(None, local_namespace, set())
176172
raise ValueError('invalid class value passed in')
177173

178174

samples/client/3_0_3_unit_test/python/tox.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
[tox]
2-
envlist = py38
32
isolated_build = True
43

54
[testenv]

samples/client/3_1_0_json_schema/python/src/json_schema_api/schemas/validation.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,7 @@
2424

2525
from . import format, original_immutabledict
2626

27-
_K = typing.TypeVar('_K')
28-
_V = typing.TypeVar('_V', covariant=True)
29-
30-
31-
class immutabledict(typing.Generic[_K, _V], original_immutabledict.immutabledict[_K, _V]):
32-
# this class layer needed to not show init signature when making new instances
33-
pass
27+
immutabledict = original_immutabledict.immutabledict
3428

3529

3630
@dataclasses.dataclass
@@ -172,7 +166,9 @@ def _get_class(
172166
elif isinstance(item_cls, type):
173167
return item_cls
174168
elif isinstance(item_cls, typing.ForwardRef):
175-
return item_cls._evaluate(None, local_namespace)
169+
if sys.version_info < (3, 9):
170+
return item_cls._evaluate(None, local_namespace)
171+
return item_cls._evaluate(None, local_namespace, set())
176172
raise ValueError('invalid class value passed in')
177173

178174

samples/client/3_1_0_json_schema/python/tox.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
[tox]
2-
envlist = py38
32
isolated_build = True
43

54
[testenv]

samples/client/openapi_features/nonCompliantUseDiscriminatorIfCompositionFails/python/src/this_package/schemas/validation.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,7 @@
2424

2525
from . import format, original_immutabledict
2626

27-
_K = typing.TypeVar('_K')
28-
_V = typing.TypeVar('_V', covariant=True)
29-
30-
31-
class immutabledict(typing.Generic[_K, _V], original_immutabledict.immutabledict[_K, _V]):
32-
# this class layer needed to not show init signature when making new instances
33-
pass
27+
immutabledict = original_immutabledict.immutabledict
3428

3529

3630
@dataclasses.dataclass
@@ -184,7 +178,9 @@ def _get_class(
184178
elif isinstance(item_cls, type):
185179
return item_cls
186180
elif isinstance(item_cls, typing.ForwardRef):
187-
return item_cls._evaluate(None, local_namespace)
181+
if sys.version_info < (3, 9):
182+
return item_cls._evaluate(None, local_namespace)
183+
return item_cls._evaluate(None, local_namespace, set())
188184
raise ValueError('invalid class value passed in')
189185

190186

samples/client/openapi_features/nonCompliantUseDiscriminatorIfCompositionFails/python/tox.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
[tox]
2-
envlist = py38
32
isolated_build = True
43

54
[testenv]

samples/client/openapi_features/security/python/src/this_package/schemas/validation.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,7 @@
2424

2525
from . import format, original_immutabledict
2626

27-
_K = typing.TypeVar('_K')
28-
_V = typing.TypeVar('_V', covariant=True)
29-
30-
31-
class immutabledict(typing.Generic[_K, _V], original_immutabledict.immutabledict[_K, _V]):
32-
# this class layer needed to not show init signature when making new instances
33-
pass
27+
immutabledict = original_immutabledict.immutabledict
3428

3529

3630
@dataclasses.dataclass
@@ -172,7 +166,9 @@ def _get_class(
172166
elif isinstance(item_cls, type):
173167
return item_cls
174168
elif isinstance(item_cls, typing.ForwardRef):
175-
return item_cls._evaluate(None, local_namespace)
169+
if sys.version_info < (3, 9):
170+
return item_cls._evaluate(None, local_namespace)
171+
return item_cls._evaluate(None, local_namespace, set())
176172
raise ValueError('invalid class value passed in')
177173

178174

samples/client/openapi_features/security/python/tox.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
[tox]
2-
envlist = py38
32
isolated_build = True
43

54
[testenv]

samples/client/petstore/python/src/petstore_api/schemas/validation.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,7 @@
2424

2525
from . import format, original_immutabledict
2626

27-
_K = typing.TypeVar('_K')
28-
_V = typing.TypeVar('_V', covariant=True)
29-
30-
31-
class immutabledict(typing.Generic[_K, _V], original_immutabledict.immutabledict[_K, _V]):
32-
# this class layer needed to not show init signature when making new instances
33-
pass
27+
immutabledict = original_immutabledict.immutabledict
3428

3529

3630
@dataclasses.dataclass
@@ -172,7 +166,9 @@ def _get_class(
172166
elif isinstance(item_cls, type):
173167
return item_cls
174168
elif isinstance(item_cls, typing.ForwardRef):
175-
return item_cls._evaluate(None, local_namespace)
169+
if sys.version_info < (3, 9):
170+
return item_cls._evaluate(None, local_namespace)
171+
return item_cls._evaluate(None, local_namespace, set())
176172
raise ValueError('invalid class value passed in')
177173

178174

0 commit comments

Comments
 (0)