Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tools/get_maintainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@

import sys
import os
from pathlib import Path

MAINTAINERS_FILE = "MAINTAINERS"
MAINTAINERS_FILE = Path(__file__).resolve().parent.parent / "MAINTAINERS"

if not os.path.exists(MAINTAINERS_FILE):
print("Error: MAINTAINERS file not found.")
print(f"Error: MAINTAINERS file not found at {MAINTAINERS_FILE}.")
sys.exit(1)

if len(sys.argv) < 2:
Expand Down
29 changes: 29 additions & 0 deletions tools/test_get_maintainer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import subprocess
import sys
import tempfile
import unittest
from pathlib import Path


ROOT = Path(__file__).resolve().parent.parent
SCRIPT = ROOT / "tools" / "get_maintainer.py"


class TestGetMaintainer(unittest.TestCase):
def test_invocation_outside_repository_root(self):
with tempfile.TemporaryDirectory() as cwd:
result = subprocess.run(
[sys.executable, str(SCRIPT), "front/parser/ast.rs"],
cwd=cwd,
capture_output=True,
text=True,
check=False,
)

self.assertEqual(result.returncode, 0, result.stderr)
self.assertIn("Maintainers to CC:", result.stdout)
self.assertNotIn("MAINTAINERS file not found", result.stdout)


if __name__ == "__main__":
unittest.main()
Loading