19 lines
800 B
Python
19 lines
800 B
Python
import os
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
from pathlib import Path
|
|
from unittest import TestCase, skipUnless
|
|
|
|
|
|
class GuiTest(TestCase):
|
|
@skipUnless(os.environ.get('DISPLAY'), 'requires X11 for OpenGL widgets')
|
|
def test_gui_isolated_from_hardware_and_closes_cleanly(self):
|
|
env={**os.environ,'QT_QPA_PLATFORM':'xcb','ROS_DOMAIN_ID':'231','ROS_LOCALHOST_ONLY':'1'}
|
|
with tempfile.TemporaryDirectory() as cache:
|
|
env['XDG_CACHE_HOME']=cache
|
|
result=subprocess.run([sys.executable,str(Path(__file__).with_name('gui_fixture.py'))],env=env,
|
|
capture_output=True,text=True,timeout=20)
|
|
self.assertEqual(result.returncode,0,result.stdout+'\n'+result.stderr)
|
|
self.assertIn('shutdown PASS',result.stdout)
|