Repository navigation
Disabled python tests that require python3 - #25556
Conversation
There was a problem hiding this comment.
2 issues found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="modules/openapi-generator/src/test/java/org/openapitools/codegen/python/AbstractPythonConnexionServerCodegenTest.java">
<violation number="1" location="modules/openapi-generator/src/test/java/org/openapitools/codegen/python/AbstractPythonConnexionServerCodegenTest.java:1007">
P2: `assertPythonSyntaxValid` already skips when `python3` is unavailable, so this annotation disables generated-test syntax validation even on capable runners. Remove `enabled = false` to retain the check where the toolchain exists.</violation>
<violation number="2" location="modules/openapi-generator/src/test/java/org/openapitools/codegen/python/AbstractPythonConnexionServerCodegenTest.java:1124">
P2: This annotation suppresses substantial Java-only title-literal and HTML-escaping coverage along with the `python3`-dependent AST check. Keep the test enabled and isolate the AST evaluation into a separately skippable test (or replace it with Java-side parsing).</violation>
</file>
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack
View guided diff | Turn on auto-fix | Re-trigger cubic
| } | ||
|
|
||
| @Test(description = "info.title is embedded in generated Python source as a Python string literal, not HTML-escaped") | ||
| @Test(description = "info.title is embedded in generated Python source as a Python string literal, not HTML-escaped", enabled = false) |
There was a problem hiding this comment.
P2: This annotation suppresses substantial Java-only title-literal and HTML-escaping coverage along with the python3-dependent AST check. Keep the test enabled and isolate the AST evaluation into a separately skippable test (or replace it with Java-side parsing).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At modules/openapi-generator/src/test/java/org/openapitools/codegen/python/AbstractPythonConnexionServerCodegenTest.java, line 1124:
<comment>This annotation suppresses substantial Java-only title-literal and HTML-escaping coverage along with the `python3`-dependent AST check. Keep the test enabled and isolate the AST evaluation into a separately skippable test (or replace it with Java-side parsing).</comment>
<file context>
@@ -1121,7 +1121,7 @@ public void testAiohttpRequirementsIncludePythonDateutil() throws IOException {
}
- @Test(description = "info.title is embedded in generated Python source as a Python string literal, not HTML-escaped")
+ @Test(description = "info.title is embedded in generated Python source as a Python string literal, not HTML-escaped", enabled = false)
public void testInfoTitleEmbeddedAsPythonStringLiteral() throws IOException, InterruptedException {
// spec title: Tom & Jerry <Service> 'quoted' "dquoted" \path
</file context>
| } | ||
|
|
||
| @Test(description = "generated tests for content (application/json) header params are valid Python syntax; kept in a separate test so a missing python3 toolchain skips only this check") | ||
| @Test(description = "generated tests for content (application/json) header params are valid Python syntax; kept in a separate test so a missing python3 toolchain skips only this check", enabled = false) |
There was a problem hiding this comment.
P2: assertPythonSyntaxValid already skips when python3 is unavailable, so this annotation disables generated-test syntax validation even on capable runners. Remove enabled = false to retain the check where the toolchain exists.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At modules/openapi-generator/src/test/java/org/openapitools/codegen/python/AbstractPythonConnexionServerCodegenTest.java, line 1007:
<comment>`assertPythonSyntaxValid` already skips when `python3` is unavailable, so this annotation disables generated-test syntax validation even on capable runners. Remove `enabled = false` to retain the check where the toolchain exists.</comment>
<file context>
@@ -1004,7 +1004,7 @@ public void testJsonContentHeaderParamsUseJsonLiteralInGeneratedTests() throws I
}
- @Test(description = "generated tests for content (application/json) header params are valid Python syntax; kept in a separate test so a missing python3 toolchain skips only this check")
+ @Test(description = "generated tests for content (application/json) header params are valid Python syntax; kept in a separate test so a missing python3 toolchain skips only this check", enabled = false)
public void testJsonContentHeaderParamsGeneratedTestsCompile() throws IOException, InterruptedException {
String specPath = "src/test/resources/3_0/python/connexion-json-header-test-values.yaml";
</file context>
| @Test(description = "generated tests for content (application/json) header params are valid Python syntax; kept in a separate test so a missing python3 toolchain skips only this check", enabled = false) | |
| @Test(description = "generated tests for content (application/json) header params are valid Python syntax; kept in a separate test so a missing python3 toolchain skips only this check") |
|
Thanks for flagging this, and sorry for the trouble. I'll send a follow-up PR that:
|
…s test The unit tests must not require a python3 toolchain (OpenAPITools#25556). Replace the python3 -m py_compile check in testEscapedNamesInAttributeMapAndApiKeyHeaders with Java assertions that pin the same guarantee: the escaped literal lines are now matched as whole lines (assertFileContainsTrimmedLine) and assertFileNotContains rules out the unterminated literal forms a missing escape would emit. The assertPythonCompiles helper goes away with its only call site, so this test no longer skips when python3 is absent. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…oolchain (#25579) The unit tests must not require a python3 toolchain (#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>
…pe names inside generated Python string literals (#25457) * fix(python-flask, python-aiohttp, python-blueplanet): don't HTML-escape names inside generated Python string literals Mustache's {{...}} HTML-escapes its value. The Connexion server templates wrote property and parameter names into Python string literals that way, so a model property named 'a&b' produced attribute_map 'ab': 'a&b' and from_dict() silently dropped its value. A ' in a name gave '''. These names are now rendered with {{{...}}} from vendor extensions that hold them escaped for a single-quoted Python literal, losslessly (backslash, quote, newline, CR, tab and other control characters): - model attribute_map (python-flask, python-aiohttp, python-blueplanet); - query keys in the generated controller tests (python-flask, python-aiohttp), and header names in python-blueplanet's generated tests. Parameters get x-python-connexion-quoted-name, the same name and meaning as in #25427, which covers the header/cookie lookups in the python-flask/python-aiohttp controllers and tests. The generated tests also sent an apiKey under the security scheme's name instead of the header name (keyParamName). They now send keyParamName, and only for apiKeys in a header. Query/cookie apiKeys are not sent, as before. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Unify fromSecurity merge and keep wire names in generated tests Merge the two fromSecurity overrides produced by the upstream merge so both the security-function-suffix and quoted-key-param-name extensions are set. Emit the escaped wire name (openapi-name or baseName) for query params and apiKey-in-query entries in x-test-query-string, and update the escaped-names test to expect the apikey query credential that the new upstream behavior correctly sends. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> * Render query names unescaped in generated controller tests Mustache HTML-escapes {{name}}, so wire names containing &, ', <, > or " were rendered as entities and the second query_string assignment sent the escaped name instead of the real one. Use {{{name}}} like the other string interpolations in these templates. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(python-blueplanet): don't HTML-escape header, cookie, and query names in the generated controller and test The generated blueplanet controller read headers and cookies via connexion.request.headers.get('{{baseName}}') / cookies.get('{{baseName}}'), and the generated test sent query parameters under the sanitized {{paramName}}. {{baseName}} is HTML-escaped by mustache, so names such as "X-A&B'Head" or "X-C&oo'kie" were emitted as "X-A&B'Head" and the lookup could never match; the query test line sent the sanitized name ("qwes") instead of the wire name ("q&we's"). Use the x-python-connexion-quoted-name vendor extension (already populated for every parameter by AbstractPythonConnexionServerCodegen) in all three places, matching python-flask and python-aiohttp. Add a cookie parameter to the escaped-names test spec, assert the generated controller and test emit the original names escaped for single-quoted Python literals, and py_compile the generated controller and test. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * [python] Drop the python3 toolchain requirement from the escaped-names test The unit tests must not require a python3 toolchain (#25556). Replace the python3 -m py_compile check in testEscapedNamesInAttributeMapAndApiKeyHeaders with Java assertions that pin the same guarantee: the escaped literal lines are now matched as whole lines (assertFileContainsTrimmedLine) and assertFileNotContains rules out the unterminated literal forms a missing escape would emit. The assertPythonCompiles helper goes away with its only call site, so this test no longer skips when python3 is absent. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@khayashi4337 please move the tests to github workflow instead, e.g. create a new one for your tests based on https://github.com/OpenAPITools/openapi-generator/blob/master/.github/workflows/samples-python-fastapi-server.yaml
as unlikely every openapi generator users have
python3installed.PR checklist
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.
Summary by cubic
Disables two Python codegen tests that require a
python3toolchain, so the test suite no longer fails on environments without it.enabled = falseand are skipped during CI runs.info.titleembedding) is retained by the test specs themselves; only the compile-time validation is skipped.Written for commit e1cd2fd. Summary will update on new commits.