Skip to content

test(python-flask, python-aiohttp, python-blueplanet): make the Connexion codegen unit tests independent of python3 - #25579

Merged
wing328 merged 1 commit into
OpenAPITools:masterfrom
khayashi4337:test/python-connexion-no-python3
Nov 9, 2026
Merged

wing328 merged 1 commit into
OpenAPITools:masterfrom
khayashi4337:test/python-connexion-no-python3

Conversation

@khayashi4337

@khayashi4337 khayashi4337 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #25556 and #25563: the Connexion server codegen unit tests no longer require a python3 toolchain — #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

  • testJsonContentHeaderParamsGeneratedTestsCompile is removed. Its only check was python3 -m py_compile on the generated test_default_controller.py, which needs the optional toolchain.
  • testInfoTitleEmbeddedAsPythonStringLiteral is re-enabled with Java-only assertions. The setup() kwargs checks are tightened to whole-line assertFileContainsTrimmedLine pins of the rendered literals (description=, keywords=[...], author_email=, plus the two lines long_description="""\ and """ that bracket the docstring literal) in all four Connexion variants (python-flask, python-flask useConnexion3=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.
  • The python3 helpers go away with them: assertPythonSyntaxValid (python3 -m py_compile) and assertSetupPyValuesMatchSpec (evaluated setup() kwargs via ast against the parsed spec).

Coverage kept

  • Local python3 verification (author-run, on this PR's tree — fix(python-flask, python-blueplanet): emitted tests are invalid Python when an operation has no cookie params #25563 is now merged): the same two checks the removed tests performed — py_compile on the generated test_default_controller.py and ast evaluation of setup() 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 official python-flask, python-flask-connexion3 and python-blueplanet configs also compiles — 11/11 test_*_controller.py (17/17 test_*.py including the models/test_*.py model classes).
  • Java: fix(python-flask, python-blueplanet): emitted tests are invalid Python when an operation has no cookie params #25563 (merged) adds testGeneratedTestsStatementIndentWithAndWithoutCookieParams to this same test class — an indentation check on the generated tests — so part of what py_compile guarded (the statement layout of the generated tests) is covered again without python3.
  • I also have a draft GitHub workflow that runs the same py_compile + ast checks 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 test with python3 removed from PATH:

master (#25563 merged) this PR
AbstractPythonConnexionServerCodegenTest 25 run, 0 failures (2 disabled) 26 run, 0 failures
PythonFlaskConnexionServerCodegenTest 22 run, 0 failures 22 run, 0 failures

cc @cbornet @tomplus @krjakbrjak @fa0311 (Python technical committee)

PR checklist

  • Read the contribution guidelines.

  • Run the following to build the project and update samples:

    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    

    (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 status shows 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 python3 toolchain on PATH.

  • Removes testJsonContentHeaderParamsGeneratedTestsCompile, which only ran python3 -m py_compile on a generated test file.
  • Re-enables testInfoTitleEmbeddedAsPythonStringLiteral with whole-line assertions on the generated setup.py literals across all four Connexion variants, replacing the previous evaluation of setup() kwargs via Python's ast.
  • Removes the assertPythonSyntaxValid and assertSetupPyValuesMatchSpec helpers.

Written for commit 3094ccb. Summary will update on new commits.

View guided diff

…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>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

View guided diff | Re-trigger cubic

@wing328
wing328 merged commit 969d1b5 into OpenAPITools:master Nov 9, 2026
15 checks passed
@wing328 wing328 added this to the 7.28.0 milestone Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants