From 3ef2d01d29ef0c2b06864ca0d00aef9880b09f9a Mon Sep 17 00:00:00 2001 From: Karan Gathani Date: Wed, 14 Oct 2026 21:16:14 -0700 Subject: [PATCH 1/2] feat: deprecate shiny add test and disable test-gen prompt verification --- .../verify-test-generation-prompts.yaml | 5 +-- .../shiny-for-python/references/testing.md | 5 +-- shiny/_main/_generate_test.py | 31 +++++++++++++++++-- tests/pytest/test_main_generate_test.py | 11 +++++++ 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/.github/workflows/verify-test-generation-prompts.yaml b/.github/workflows/verify-test-generation-prompts.yaml index 9b29d13f9..4ea51a716 100644 --- a/.github/workflows/verify-test-generation-prompts.yaml +++ b/.github/workflows/verify-test-generation-prompts.yaml @@ -1,10 +1,7 @@ name: Verify test generation prompts on: - pull_request: - paths: - - ".github/workflows/verify-test-generation-prompts.yaml" - - "shiny/pytest/_generate/**" + # Disabled for now: `shiny add test` is deprecated. Run manually only. workflow_dispatch: concurrency: diff --git a/shiny/.agents/skills/shiny-for-python/references/testing.md b/shiny/.agents/skills/shiny-for-python/references/testing.md index b5bc16605..88077ee15 100644 --- a/shiny/.agents/skills/shiny-for-python/references/testing.md +++ b/shiny/.agents/skills/shiny-for-python/references/testing.md @@ -149,8 +149,9 @@ pytest test_app.py --tracing retain-on-failure # then: playwright show-trace Path: return Path(output_file_val) +def warn_deprecated() -> None: + click.echo( + cli_warning( + click.style( + "`shiny add test` is deprecated and will be removed within the " + "next few releases.", + fg="yellow", + bold=True, + ) + ), + err=True, + ) + click.echo( + click.style( + " Use the `shiny-for-python` skill with an agent harness to " + "generate tests instead.", + fg="yellow", + ), + err=True, + ) + + def generate_test_file( *, app_file: str | None, @@ -120,7 +142,6 @@ def generate_test_file( provider: str, model: str | None, ) -> None: - try: validate_api_key(provider) @@ -171,11 +192,16 @@ def add() -> None: @add.command( "test", + deprecated=True, help="""Add a test file for a specified Shiny app. Generate a comprehensive test file for a specified app using AI. The generator will analyze your app code and create appropriate test cases with assertions. +NOTE: `shiny add test` is deprecated and will be removed within the next few +releases. Use the `shiny-for-python` skill with an agent harness to generate +tests for your Shiny for Python apps instead. + After creating the test file, you can use `pytest` to run the tests: pytest TEST_FILE @@ -210,6 +236,7 @@ def test( provider: str, model: str | None, ) -> None: + warn_deprecated() generate_test_file( app_file=app, output_file=test_file, provider=provider, model=model ) diff --git a/tests/pytest/test_main_generate_test.py b/tests/pytest/test_main_generate_test.py index 947f0bf4d..f3f7e53f5 100644 --- a/tests/pytest/test_main_generate_test.py +++ b/tests/pytest/test_main_generate_test.py @@ -25,6 +25,17 @@ def test_add_group_lists_test_command() -> None: assert result.exit_code == 0 assert "test" in result.output + assert "deprecated" in result.output.lower() + + +def test_add_test_warns_about_deprecation( + captured_generate: dict[str, Any], +) -> None: + result = CliRunner().invoke(main, ["add", "test"]) + + assert result.exit_code == 0 + assert "deprecated" in result.output.lower() + assert "shiny-for-python" in result.output def test_add_test_forwards_options(captured_generate: dict[str, Any]) -> None: From 7ac8abd825729537adfc53a84c3cd3ef77c1f030 Mon Sep 17 00:00:00 2001 From: Karan Gathani Date: Thu, 15 Oct 2026 13:51:47 -0700 Subject: [PATCH 2/2] docs(agents): remove Generate a test with AI section from testing reference --- shiny/.agents/skills/shiny-for-python/references/testing.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/shiny/.agents/skills/shiny-for-python/references/testing.md b/shiny/.agents/skills/shiny-for-python/references/testing.md index 88077ee15..b35fd8bdd 100644 --- a/shiny/.agents/skills/shiny-for-python/references/testing.md +++ b/shiny/.agents/skills/shiny-for-python/references/testing.md @@ -147,12 +147,6 @@ pytest test_app.py --headed # watch the browser pytest test_app.py --tracing retain-on-failure # then: playwright show-trace ``` -## Generate a test with AI - -`shiny add test` is deprecated and will be removed in a future release. Prefer -generating tests with an agent harness using this `shiny-for-python` skill; the -skill documents the controller API and test patterns the generator relies on. - ## Common mistakes - Test times out with a blank page → you forgot `page.goto(local_app.url)`.