from pathlib import Path import pytest from nisse_dev.main import main def test_main_refuses_to_start_without_a_config_file( monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str], tmp_path: Path, ) -> None: # Run from an empty directory, and point NISSE_ENV at a file that does not # exist: the repository's .env holds live credentials, and a test must # never be one cwd away from starting a real agent. monkeypatch.chdir(tmp_path) monkeypatch.delenv("NISSE_CONFIG", raising=False) monkeypatch.setenv("NISSE_ENV", str(tmp_path / "absent.env")) assert main() == 2 err = capsys.readouterr().err assert "cannot start" in err assert "nisse-dev.example.yaml" in err