35 lines
2.6 KiB
Python
35 lines
2.6 KiB
Python
"""The experimental input mode must refuse unrelated projects before any setup."""
|
|
from pathlib import Path
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
import unittest
|
|
ROOT=Path(__file__).resolve().parents[1]
|
|
class FlightActionRunner(unittest.TestCase):
|
|
def test_scope_refused_without_profile_or_process_setup(self):
|
|
for project,smoke in [('core','victory'),('chat','victory'),('chat','powered-flight')]:
|
|
with self.subTest(project=project,smoke=smoke),tempfile.TemporaryDirectory() as directory:
|
|
root=Path(directory)
|
|
result=subprocess.run([sys.executable,str(ROOT/'tools/headless_workbench.py'),'--compat',str(root/'prefix'),'--profile',str(root/'profile'),'--project',project,'--smoke',smoke,'--rounds','1','--timeout','420','--flight-action-inputs'],capture_output=True,text=True)
|
|
self.assertNotEqual(result.returncode,0)
|
|
self.assertIn('flight-action-inputs requires the Core powered-flight fixture',result.stderr)
|
|
self.assertEqual(list(root.iterdir()),[])
|
|
def test_autohover_requires_explicit_action_input_fixture(self):
|
|
for project,smoke,extra in [('core','victory',[]),('chat','powered-flight',['--flight-action-inputs']),('core','powered-flight',[])]:
|
|
with self.subTest(project=project,smoke=smoke,extra=extra),tempfile.TemporaryDirectory() as directory:
|
|
root=Path(directory)
|
|
result=subprocess.run([sys.executable,str(ROOT/'tools/headless_workbench.py'),'--compat',str(root/'prefix'),'--profile',str(root/'profile'),'--project',project,'--smoke',smoke,'--rounds','1','--timeout','420','--flight-autohover',*extra],capture_output=True,text=True)
|
|
self.assertNotEqual(result.returncode,0)
|
|
self.assertIn('flight-autohover requires Core powered-flight with flight-action-inputs',result.stderr)
|
|
self.assertEqual(list(root.iterdir()),[])
|
|
self.assertIn("if a.flight_autohover: command += ['-errFlightAutohover', '1']",(ROOT/'tools/headless_workbench.py').read_text())
|
|
def test_valid_scope_still_requires_disposable_prefix(self):
|
|
with tempfile.TemporaryDirectory() as directory:
|
|
root=Path(directory)
|
|
result=subprocess.run([sys.executable,str(ROOT/'tools/headless_workbench.py'),'--compat',str(root/'prefix'),'--profile',str(root/'profile'),'--project','core','--smoke','powered-flight','--rounds','1','--timeout','420','--flight-action-inputs'],capture_output=True,text=True)
|
|
self.assertNotEqual(result.returncode,0)
|
|
self.assertIn('must be a disposable cloned prefix',result.stderr)
|
|
self.assertEqual(list(root.iterdir()),[])
|
|
self.assertIn("if a.flight_action_inputs: command += ['-errFlightActionInputs', '1']",(ROOT/'tools/headless_workbench.py').read_text())
|
|
if __name__=='__main__':unittest.main()
|