def test_rosmsg_cmd_packages(self): from rosmsg import rosmsg_cmd_packages, MODE_MSG, MODE_SRV with fakestdout() as b: rosmsg_cmd_packages(MODE_MSG, 'foo', ['packages']) val = b.getvalue().strip() packages1 = val.split('\n') assert 'std_msgs' in packages1 with fakestdout() as b: rosmsg_cmd_packages(MODE_MSG, 'foo', ['packages', '-s']) val = b.getvalue().strip() packages2 = val.split(' ') assert 'std_msgs' in packages2 assert set(packages1) == set(packages2), "%s vs. %s"%(packages1, packages2)