Files
lda Verified 038e152bbc
Checks / tests (ubuntu-latest, 3.11) (push) Canceled after 0s
Checks / tests (ubuntu-latest, 3.14) (push) Canceled after 0s
Checks / tests (windows-latest, 3.11) (push) Canceled after 0s
Checks / tests (windows-latest, 3.14) (push) Canceled after 0s
Checks / package (push) Canceled after 0s
Add MX-T40 BLE desktop controller and protocol documentation
2026-10-25 04:43:47 +07:00

47 lines
1.6 KiB
Python

"""Guard the seam between private firmware research and publishable source."""
import tempfile
import unittest
from pathlib import Path
from scripts.export_project import export_project
class ExportTests(unittest.TestCase):
def test_excludes_vendor_inputs_and_preserves_source(self):
with tempfile.TemporaryDirectory() as temporary:
root = Path(temporary) / "workspace"
for name in (
"controller/main.py",
"controller/cache.bin",
"README.md",
"analysis/app-source/Vendor.java",
"speaker.bin",
"app.apk",
".env",
):
path = root / name
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text("fixture")
output = Path(temporary) / "export"
export_project(root, output)
self.assertEqual(
sorted(
str(path.relative_to(output)).replace("\\", "/")
for path in output.rglob("*")
if path.is_file()
),
["README.md", "controller/main.py"],
)
def test_refuses_existing_content(self):
with tempfile.TemporaryDirectory() as temporary:
root = Path(temporary)
output = root / "export"
output.mkdir()
marker = output / "keep.txt"
marker.write_text("do not replace")
with self.assertRaises(ValueError):
export_project(root, output)
self.assertEqual(marker.read_text(), "do not replace")