import os import subprocess import sys from pathlib import Path from unittest import TestCase class RosInterfacesTest(TestCase): def test_fake_driver_on_private_dds_domain(self): env={**os.environ,'ROS_DOMAIN_ID':'231','ROS_LOCALHOST_ONLY':'1'} result=subprocess.run([sys.executable,str(Path(__file__).with_name('ros_fixture.py'))],env=env, capture_output=True,text=True,timeout=25) self.assertEqual(result.returncode,0,result.stdout+'\n'+result.stderr) self.assertIn('dynamic camera subscriptions PASS',result.stdout) def test_new_device_nodes_with_fake_hardware(self): env={**os.environ,'ROS_DOMAIN_ID':'232','ROS_LOCALHOST_ONLY':'1'} result=subprocess.run([sys.executable,str(Path(__file__).with_name('device_nodes_fixture.py'))], env=env,capture_output=True,text=True,timeout=20) self.assertEqual(result.returncode,0,result.stdout+'\n'+result.stderr) self.assertIn('offline status PASS',result.stdout)