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
28 changes: 28 additions & 0 deletions tools/test_x.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Tests for the repository build driver."""

import subprocess
import sys
import unittest
from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]


class XPyTests(unittest.TestCase):
def test_unknown_command_fails_without_running_a_build(self):
result = subprocess.run(
[sys.executable, str(ROOT / "x.py"), "unrecognized-audit-command"],
cwd=ROOT,
capture_output=True,
text=True,
check=False,
)

self.assertEqual(result.returncode, 1)
self.assertIn("Unknown command: unrecognized-audit-command", result.stdout)
self.assertIn("Usage: x.py", result.stdout)


if __name__ == "__main__":
unittest.main()
1 change: 1 addition & 0 deletions x.py
Original file line number Diff line number Diff line change
Expand Up @@ -1337,6 +1337,7 @@ def main():
else:
print("Unknown command:", cmd)
print("Usage: x.py [install | build | package | release | clean | gui] [target...]")
sys.exit(1)

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