Skip to content

feat(cli): add fleet/__main__.py so python3 -m fleet works - #61

Merged
belarusian merged 2 commits into
mainfrom
build13/main-module
Aug 19, 2026
Merged

feat(cli): add fleet/__main__.py so python3 -m fleet works#61
belarusian merged 2 commits into
mainfrom
build13/main-module

Conversation

@belarusian

Copy link
Copy Markdown
Owner

Summary

The fleet package had no __main__.py, so python3 -m fleet failed with No module named fleet.__main__ even though the fleet console script and fleet.cli:main both work. This adds the missing __main__ module (delegation only) and pins it with two subprocess tests.

Changes

  • fleet/__main__.py (new): delegates to fleet.cli:main exactly — from fleet.cli import main + if __name__ == "__main__": sys.exit(main()). No argument parsing reimplemented; main() already owns the parser (including the top-level --version flag from Cycle 12).
  • tests/test_cli.py:
    • test_python_m_fleet_help_exits_zero — runs python3 -m fleet --help as a subprocess from a neutral tmp_path with PYTHONPATH set to the repo root; asserts returncode == 0 and the help text mentions the status subcommand.
    • test_python_m_fleet_version_exits_zero_and_prints_version — runs python3 -m fleet --version the same way; asserts returncode == 0 and stdout is exactly fleet 0.1.0 (exercises the sys.exit(main()) path with argparse action="version" SystemExit).
  • tickets/: TICKET-052 (version subprocess test), TICKET-053 (README note — deferred, out of scope for this one-file + one-test cycle).

Gate

  • pytest tests/ -x -q: 110 passed (was 108)
  • ruff check fleet/: clean
  • mypy fleet/ --ignore-missing-imports: clean (7 source files)

Closes #59. Closes #60.

- fleet/__main__.py (new): delegate to fleet.cli:main (same entry as the
  console script) - 'from fleet.cli import main' + 'if __name__ ==
  "__main__": sys.exit(main())'. No argument parsing reimplemented.
- tests/test_cli.py: test_python_m_fleet_help_exits_zero runs
  'python3 -m fleet --help' as a subprocess from a neutral tmp_path with
  PYTHONPATH set to the repo root; asserts returncode==0 and that the help
  text mentions the status subcommand.
- tests/test_cli.py: test_python_m_fleet_version_exits_zero_and_prints_version
  runs 'python3 -m fleet --version' the same way; asserts returncode==0 and
  that stdout is exactly 'fleet 0.1.0' (exercises the sys.exit(main()) path
  with argparse's action="version" SystemExit).
- tickets: TICKET-052 (version subprocess test), TICKET-053 (README note,
  deferred - out of scope for this one-file + one-test cycle).

Closes #59. Closes #60.
@belarusian
belarusian merged commit f659447 into main Aug 19, 2026
2 checks passed
@belarusian
belarusian deleted the build13/main-module branch August 19, 2026 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Subprocess test should also verify --version via python3 -m fleet (TICKET-052) Add fleet/__main__.py so python3 -m fleet works (TICKET-051)

1 participant