Skip to content

test_cli_command_help fails on main: PROMPT_FILE now optional #400

@jamesdlevine

Description

@jamesdlevine

Bug Description

The test tests/test_core_cli.py::test_cli_command_help fails on the main branch.

Test Output

def test_cli_command_help(runner):
    """Test `pdd [COMMAND] --help`."""
    result = runner.invoke(cli.cli, ["generate", "--help"])
    assert result.exit_code == 0
>   assert "Usage: cli generate [OPTIONS] PROMPT_FILE" in result.output
E   AssertionError: assert 'Usage: cli generate [OPTIONS] PROMPT_FILE' in '...Usage: cli generate [OPTIONS] [PROMPT_FILE]...'

Root Cause

The generate command's PROMPT_FILE argument was made optional (shown as [PROMPT_FILE] in help) when the --template option was added as an alternative. The test was not updated to reflect this change.

Actual CLI Help Output

Usage: cli generate [OPTIONS] [PROMPT_FILE]

  Create runnable code from a prompt file.

Options:
  --template TEXT         Use a template instead of a prompt file.
  -e, --env TEXT          Set environment variables (KEY=VALUE or KEY).
  --output TEXT           Specify where to save the generated code.
  --original-prompt PATH  Original prompt file for incremental generation.
  --incremental           Force incremental patching.
  --unit-test PATH        Path to a unit test file for TDD.
  --exclude-tests         Do not automatically include test files.
  --help                  Show this message and exit.

Proposed Fix

Update the test assertion from:

assert "Usage: cli generate [OPTIONS] PROMPT_FILE" in result.output

To:

assert "Usage: cli generate [OPTIONS] [PROMPT_FILE]" in result.output

Verification

Tested on main branch at commit 0c5301c:

python -m pytest tests/test_core_cli.py::test_cli_command_help -v
# Result: FAILED

Environment

  • Branch: main
  • Commit: 0c5301c
  • Python: 3.12.12
  • pytest: 8.3.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions