"""Smoke tests for the mgf-cloud skeleton (Pass 1)."""

from __future__ import annotations

import subprocess
import sys

import pytest

import mgf.cloud as cloud
from mgf.cloud.__main__ import build_parser, main


@pytest.mark.smoke
def test_version_is_set() -> None:
    assert cloud.__version__
    assert isinstance(cloud.__version__, str)


@pytest.mark.smoke
def test_parser_has_version_subcommand() -> None:
    parser = build_parser()
    args = parser.parse_args(["version"])
    assert args.command == "version"


@pytest.mark.smoke
def test_main_version_returns_zero(capsys: pytest.CaptureFixture[str]) -> None:
    rc = main(["version"])
    assert rc == 0
    assert "mgf-cloud" in capsys.readouterr().out


@pytest.mark.smoke
def test_cli_module_runs() -> None:
    proc = subprocess.run(
        [sys.executable, "-m", "mgf.cloud", "version"],
        capture_output=True,
        text=True,
        check=True,
    )
    assert "mgf-cloud" in proc.stdout
