Skip to content

Disabled python tests that require python3 - #25556

Merged
wing328 merged 1 commit into
masterfrom
disable-python-compile-test
Nov 4, 2026
Merged

wing328 merged 1 commit into
masterfrom
disable-python-compile-test

Conversation

@wing328

@wing328 wing328 commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

@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 python3 installed.

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.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Disables two Python codegen tests that require a python3 toolchain, so the test suite no longer fails on environments without it.

  • The tests are annotated with enabled = false and are skipped during CI runs.
  • Coverage for the underlying behavior (JSON header params and info.title embedding) is retained by the test specs themselves; only the compile-time validation is skipped.

Written for commit e1cd2fd. Summary will update on new commits.

View guided diff Turn on auto-fix

@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.

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)

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.

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)

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.

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>
Suggested change
@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")

@wing328
wing328 merged commit c60a9cf into master Nov 4, 2026
15 checks passed
@wing328
wing328 deleted the disable-python-compile-test branch November 4, 2026 09:56
@wing328 wing328 added this to the 7.28.0 milestone Nov 4, 2026
@khayashi4337

Copy link
Copy Markdown
Contributor

Thanks for flagging this, and sorry for the trouble.

I'll send a follow-up PR that:

  1. keeps the Java-only assertions of the two disabled tests (testJsonContentHeaderParamsGeneratedTestsCompile, testInfoTitleEmbeddedAsPythonStringLiteral) as regular tests, so ./mvnw test no longer needs python3, and
  2. moves the python3-based checks (py_compile of the generated controller tests, and evaluating the generated setup.py with Python's ast) into a new GitHub workflow modelled on samples-python-fastapi-server.yaml.

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