24 lines
708 B
Python
24 lines
708 B
Python
"""The protocol and CLI must remain usable on machines without a display."""
|
|
|
|
import subprocess
|
|
import sys
|
|
import unittest
|
|
|
|
|
|
class ImportTests(unittest.TestCase):
|
|
def test_headless_import_and_help(self):
|
|
script = """
|
|
import sys
|
|
from controller import protocol, session, messages, discovery, cli
|
|
assert 'tkinter' not in sys.modules
|
|
assert 'bleak' not in sys.modules
|
|
try:
|
|
cli.main(['--help'])
|
|
except SystemExit as exc:
|
|
assert exc.code == 0
|
|
assert 'tkinter' not in sys.modules
|
|
"""
|
|
result = subprocess.run([sys.executable, "-c", script], capture_output=True, text=True)
|
|
self.assertEqual(result.returncode, 0, result.stderr)
|
|
self.assertIn("--transport", result.stdout)
|