You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Copy file name to clipboardExpand all lines: shiny/_main.py
+9-46Lines changed: 9 additions & 46 deletions
Original file line number
Diff line number
Diff line change
@@ -530,56 +530,16 @@ def add() -> None:
530
530
pass
531
531
532
532
533
-
@main.group(help="""Generate files for your Shiny app using AI.""")
534
-
defgenerate() ->None:
535
-
pass
536
-
537
-
538
533
@add.command(
539
534
help="""Add a test file for a specified Shiny app.
540
535
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
-
deftest(
564
-
app: Path|None,
565
-
test_file: Path|None,
566
-
) ->None:
567
-
from ._main_add_testimportadd_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
-
576
536
Generate a comprehensive test file for a specified app using AI. The generator
577
537
will analyze your app code and create appropriate test cases with assertions.
578
538
579
539
After creating the test file, you can use `pytest` to run the tests:
580
540
581
541
pytest TEST_FILE
582
-
""",
542
+
"""
583
543
)
584
544
@click.option(
585
545
"--app",
@@ -588,8 +548,8 @@ def test(
588
548
help="Path to the app file for which you want to generate a test file.",
589
549
)
590
550
@click.option(
591
-
"--output",
592
-
"-o",
551
+
"--test-file",
552
+
"-t",
593
553
type=str,
594
554
help="Path for the generated test file. If not provided, will be auto-generated.",
595
555
)
@@ -604,15 +564,18 @@ def test(
604
564
type=str,
605
565
help="Specific model to use (optional). Examples: haiku3.5, sonnet, gpt-4.1, o3-mini",
0 commit comments