Added executable root launcher for audita
This commit is contained in:
12
tests/test_cli.py
Normal file
12
tests/test_cli.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import pytest
|
||||
|
||||
from audita.cli import main
|
||||
|
||||
|
||||
def test_cli_help_uses_audita_program_name(capsys):
|
||||
with pytest.raises(SystemExit) as exc:
|
||||
main(["--help"])
|
||||
|
||||
assert exc.value.code == 0
|
||||
assert capsys.readouterr().out.startswith("usage: audita ")
|
||||
|
||||
31
tests/test_launcher.py
Normal file
31
tests/test_launcher.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
LAUNCHER = ROOT / "audita"
|
||||
|
||||
|
||||
def test_root_launcher_exists_and_is_executable():
|
||||
assert LAUNCHER.is_file()
|
||||
assert os.access(LAUNCHER, os.X_OK)
|
||||
|
||||
|
||||
def test_root_launcher_help_smoke():
|
||||
if shutil.which("uv") is None:
|
||||
pytest.skip("uv is not installed")
|
||||
|
||||
result = subprocess.run(
|
||||
[str(LAUNCHER), "--help"],
|
||||
cwd=ROOT,
|
||||
text=True,
|
||||
capture_output=True,
|
||||
check=False,
|
||||
)
|
||||
|
||||
assert result.returncode == 0
|
||||
assert result.stdout.startswith("usage: audita ")
|
||||
Reference in New Issue
Block a user