Files
nisse/tests/integration/test_entry_points.py
dongarandClaude Opus 5.5 6aa1439a7f
CI / checks (push) Skipped
CI / checks (pull_request) Successful in 5m28s
Entry-point test: a config with no projects is named in the startup errors
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPQ14L3LikyefCMFBqEbKE
2026-10-06 02:36:06 +00:00

48 lines
1.5 KiB
Python

"""Integration tests: run the installed console scripts as real subprocesses."""
import os
import subprocess
from pathlib import Path
import pytest
pytestmark = pytest.mark.integration
def test_ops_entry_point_runs_and_greets() -> None:
result = subprocess.run(
["nisse-ops"], capture_output=True, text=True, timeout=30, check=False
)
assert result.returncode == 0
assert result.stdout == "Hello from nisse-ops, the house spirit is awake.\n"
def test_dev_entry_point_refuses_to_start_unconfigured(tmp_path: Path) -> None:
"""An incomplete config must fail at startup, naming everything absent.
Run from an empty directory, with an empty config file and a .env path
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.
"""
config = tmp_path / "nisse-dev.yaml"
config.write_text("")
result = subprocess.run(
["nisse-dev"],
capture_output=True,
text=True,
timeout=30,
check=False,
cwd=tmp_path,
env={
"PATH": os.environ["PATH"],
"HOME": os.environ["HOME"],
"NISSE_ENV": "/nonexistent/.env",
"NISSE_CONFIG": str(config),
},
)
assert result.returncode == 2
assert "cannot start" in result.stderr
# All of them at once, not the first one it happened to reach.
for expected in ("state_db", "matrix.token", "projects: must name at least one"):
assert expected in result.stderr