Repository navigation
test(python-flask, python-aiohttp, python-blueplanet): make the Connexion codegen unit tests independent of python3 - #25579
Merged
wing328 merged 1 commit intoNov 9, 2026
Conversation
…oolchain The unit tests must not require a python3 toolchain (OpenAPITools#25556), so the python3-based checks are removed or replaced with Java assertions: - testJsonContentHeaderParamsGeneratedTestsCompile is removed; it only ran `python3 -m py_compile` on the generated test file, which needs the optional toolchain the unit tests must not depend on. - testInfoTitleEmbeddedAsPythonStringLiteral is re-enabled with Java-only assertions, tightened to whole-line assertFileContainsTrimmedLine checks for the setup.py kwargs literals in all four variants. The python3 helpers that evaluated setup() kwargs via ast and compiled generated tests via py_compile (assertSetupPyValuesMatchSpec, assertPythonSyntaxValid) are removed with it. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #25556 and #25563: the Connexion server codegen unit tests no longer require a
python3toolchain — #25556 disabled two tests because they need python3, and this PR resolves them for good instead of leaving them disabled.This PR contains Java test changes only — no GitHub workflow and no helper script are included. The python3-based checks are not dropped silently; see "Coverage kept" below.
What changed
testJsonContentHeaderParamsGeneratedTestsCompileis removed. Its only check waspython3 -m py_compileon the generatedtest_default_controller.py, which needs the optional toolchain.testInfoTitleEmbeddedAsPythonStringLiteralis re-enabled with Java-only assertions. Thesetup()kwargs checks are tightened to whole-lineassertFileContainsTrimmedLinepins of the rendered literals (description=,keywords=[...],author_email=, plus the two lineslong_description="""\and"""that bracket the docstring literal) in all four Connexion variants (python-flask, python-flaskuseConnexion3=true, python-aiohttp, python-blueplanet). Because each pin must match the whole trimmed line, a line carrying anything extra — e.g. a literal that stops short and leaves trailing content — can no longer pass.assertPythonSyntaxValid(python3 -m py_compile) andassertSetupPyValuesMatchSpec(evaluatedsetup()kwargs viaastagainst the parsed spec).Coverage kept
py_compileon the generatedtest_default_controller.pyandastevaluation ofsetup()kwargs against the spec — were run over 2 specs × 4 variants = 8/8 combinations, all OK with an author-run local script (not part of this PR). Every test module generated by the officialpython-flask,python-flask-connexion3andpython-blueplanetconfigs also compiles — 11/11test_*_controller.py(17/17test_*.pyincluding themodels/test_*.pymodel classes).testGeneratedTestsStatementIndentWithAndWithoutCookieParamsto this same test class — an indentation check on the generated tests — so part of whatpy_compileguarded (the statement layout of the generated tests) is covered again without python3.astchecks on every related change (it has only been run locally, not on GitHub Actions); I can send it as a separate PR if you would like it.Test results
./mvnw -pl modules/openapi-generator -am -Dtest=AbstractPythonConnexionServerCodegenTest,PythonFlaskConnexionServerCodegenTest testwithpython3removed fromPATH:AbstractPythonConnexionServerCodegenTestPythonFlaskConnexionServerCodegenTestcc @cbornet @tomplus @krjakbrjak @fa0311 (Python technical committee)
PR checklist
Read the contribution guidelines.
Run the following to build the project and update samples:
(For Windows users, please run the script in WSL)
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
(Test-only change — no generator code is touched. Verified by rebuilding the CLI jar (
./mvnw -DskipTests -pl modules/openapi-generator-cli -am package) and regenerating the three Python Connexion sample configs (python-flask,python-flask-connexion3,python-blueplanet):git statusshows no diff.)If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
🤖 Generated with Claude Code
Summary by cubic
Makes the Connexion server codegen unit tests run entirely within Java, so the test suite no longer requires a
python3toolchain on PATH.testJsonContentHeaderParamsGeneratedTestsCompile, which only ranpython3 -m py_compileon a generated test file.testInfoTitleEmbeddedAsPythonStringLiteralwith whole-line assertions on the generatedsetup.pyliterals across all four Connexion variants, replacing the previous evaluation ofsetup()kwargs via Python'sast.assertPythonSyntaxValidandassertSetupPyValuesMatchSpechelpers.Written for commit 3094ccb. Summary will update on new commits.