Skip to content

moduletester init` CLI command — interactive project scaffolding #20

Description

@ThomasMalletCodra

Description

Add a moduletester init CLI command that interactively generates the moduletester.ini configuration file, creates the recommended test directory structure, and optionally adds # guitest: markers to existing test files. This reduces onboarding time to under a minute for new projects.

Current behavior

  • Users must manually create moduletester.ini from scratch or copy from another project.
  • No guidance on recommended directory structure or marker usage.
  • Easy to miss required configuration options.

Expected behavior

  • Running moduletester init in a project root starts an interactive wizard:
    $ moduletester init
    Project name [my_project]: mypackage
    Test package [mypackage.tests]: mypackage.tests
    Test directory [tests/]: tests/
    Add guitest markers to existing test files? [y/N]: y
    Export format [html/docx/both]: html
    Created moduletester.ini
    Scanned 12 test files, added markers to 8 files.
    Ready! Run: moduletester -p mypackage.tests
    
  • Generates a well-commented moduletester.ini with sensible defaults.
  • Optionally scans existing test files and adds # guitest: show markers.
  • Creates missing directories if needed.

Implementation ideas

  1. Add init subcommand to the existing CLI entry point.
  2. Use input() prompts or questionary library for interactive mode.
  3. Support --non-interactive flag with CLI arguments for CI usage.
  4. Template moduletester.ini with comments explaining each option.
  5. File scanner that detects def test_ or class Test patterns and adds markers.

Acceptance criteria

  • moduletester init generates a valid moduletester.ini
  • Interactive mode asks relevant questions with sensible defaults
  • Non-interactive mode supports all options via CLI arguments
  • Existing test files can be scanned and annotated with markers
  • Generated config includes comments explaining each option
  • Does not overwrite existing moduletester.ini without confirmation

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions