"""Syntax-check the sudoers drop-in via visudo before it leaves the repo.""" import shutil import subprocess from pathlib import Path import pytest SUDOERS = Path(__file__).resolve().parents[2] / "deploy/files/etc/sudoers.d/left4me" @pytest.mark.skipif(shutil.which("visudo") is None, reason="visudo not installed") def test_sudoers_parses(): result = subprocess.run( ["visudo", "-cf", str(SUDOERS)], capture_output=True, text=True, ) assert result.returncode == 0, f"visudo -cf failed: {result.stdout}{result.stderr}"