47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
#!/usr/bin/env python3
|
|
|
|
import subprocess
|
|
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(PROJECT_ROOT))
|
|
|
|
import jwebot_edge # noqa: E402
|
|
from jwebot_kernel import edge_runtime # noqa: E402
|
|
|
|
|
|
class EdgeCompatibilityTests(unittest.TestCase):
|
|
def test_import_alias_is_the_packaged_runtime_module(self):
|
|
self.assertIs(jwebot_edge, edge_runtime)
|
|
|
|
def test_legacy_module_mutation_affects_runtime_globals(self):
|
|
original = edge_runtime.CLOUD_HOST if hasattr(edge_runtime, "CLOUD_HOST") else None
|
|
jwebot_edge.COMPATIBILITY_TEST_VALUE = "value"
|
|
try:
|
|
self.assertEqual(edge_runtime.COMPATIBILITY_TEST_VALUE, "value")
|
|
finally:
|
|
del edge_runtime.COMPATIBILITY_TEST_VALUE
|
|
self.assertEqual(
|
|
edge_runtime.CLOUD_HOST if hasattr(edge_runtime, "CLOUD_HOST") else None,
|
|
original,
|
|
)
|
|
|
|
def test_root_cli_still_exposes_help(self):
|
|
result = subprocess.run(
|
|
[sys.executable, str(PROJECT_ROOT / "jwebot_edge.py"), "--help"],
|
|
text=True,
|
|
capture_output=True,
|
|
timeout=10,
|
|
check=False,
|
|
)
|
|
self.assertEqual(result.returncode, 0)
|
|
self.assertIn("Local, low-latency router", result.stdout)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|
|
|