Skip to content

Commit a83ba1c

Browse files
committed
Remove add_test command and update test generation
Deleted the add_test command and its implementation, consolidating test file creation under the AI-powered test generation command. Updated CLI options and refactored parameter names for consistency. Also adjusted MAX_TOKENS in the test generator config.
1 parent 03233b3 commit a83ba1c

File tree

3 files changed

+10
-150
lines changed

3 files changed

+10
-150
lines changed

shiny/_main.py

Lines changed: 9 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -530,56 +530,16 @@ def add() -> None:
530530
pass
531531

532532

533-
@main.group(help="""Generate files for your Shiny app using AI.""")
534-
def generate() -> None:
535-
pass
536-
537-
538533
@add.command(
539534
help="""Add a test file for a specified Shiny app.
540535
541-
Add an empty test file for a specified app. You will be prompted with a destination
542-
folder. If you don't provide a destination folder, it will be added in the current
543-
working directory based on the app name.
544-
545-
After creating the shiny app file, you can use `pytest` to run the tests:
546-
547-
pytest TEST_FILE
548-
"""
549-
)
550-
@click.option(
551-
"--app",
552-
"-a",
553-
type=str,
554-
help="Please provide the path to the app file for which you want to create a test file.",
555-
)
556-
@click.option(
557-
"--test-file",
558-
"-t",
559-
type=str,
560-
help="Please provide the name of the test file you want to create. The basename of the test file should start with `test_` and be unique across all test files.",
561-
)
562-
# Param for app.py, param for test_name
563-
def test(
564-
app: Path | None,
565-
test_file: Path | None,
566-
) -> None:
567-
from ._main_add_test import add_test_file
568-
569-
add_test_file(app_file=app, test_file=test_file)
570-
571-
572-
@generate.command(
573-
"test",
574-
help="""Generate AI-powered test file for a specified Shiny app.
575-
576536
Generate a comprehensive test file for a specified app using AI. The generator
577537
will analyze your app code and create appropriate test cases with assertions.
578538
579539
After creating the test file, you can use `pytest` to run the tests:
580540
581541
pytest TEST_FILE
582-
""",
542+
"""
583543
)
584544
@click.option(
585545
"--app",
@@ -588,8 +548,8 @@ def test(
588548
help="Path to the app file for which you want to generate a test file.",
589549
)
590550
@click.option(
591-
"--output",
592-
"-o",
551+
"--test-file",
552+
"-t",
593553
type=str,
594554
help="Path for the generated test file. If not provided, will be auto-generated.",
595555
)
@@ -604,15 +564,18 @@ def test(
604564
type=str,
605565
help="Specific model to use (optional). Examples: haiku3.5, sonnet, gpt-4.1, o3-mini",
606566
)
607-
def test_generate(
567+
# Param for app.py, param for test_name
568+
def test(
608569
app: str | None,
609-
output: str | None,
570+
test_file: str | None,
610571
provider: str,
611572
model: str | None,
612573
) -> None:
613574
from ._main_generate_test import generate_test_file
614575

615-
generate_test_file(app_file=app, output_file=output, provider=provider, model=model)
576+
generate_test_file(
577+
app_file=app, output_file=test_file, provider=provider, model=model
578+
)
616579

617580

618581
@main.command(

shiny/_main_add_test.py

Lines changed: 0 additions & 103 deletions
This file was deleted.

shiny/testing/generator/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Config:
3434
DEFAULT_OPENAI_MODEL = "gpt-4.1-nano"
3535
DEFAULT_PROVIDER = "anthropic"
3636

37-
MAX_TOKENS = 64000
37+
MAX_TOKENS = 8092
3838
LOG_FILE = "llm_test_generator.log"
3939
COMMON_APP_PATTERNS = ["app.py", "app_*.py"]
4040

0 commit comments

Comments
 (0)