3 from catkin.find_in_workspaces
import find_in_workspaces
4 import zipfile_interface
6 from roscompile
import get_functions
9 FILE_ERROR_MESSAGE =
'These files should have been {} but weren\'t: {}' 11 zipfile = find_in_workspaces(path=
'roscompile/test/test_data.zip', first_match_only=
True)[0]
12 config, cases = zipfile_interface.get_test_cases(zipfile)
17 for test_config
in config:
18 yield roscompile_check, test_config[
'in'], test_config[
'out'], \
19 test_config[
'functions'], test_config.get(
'subpkg',
None), test_config.get(
'config', {})
22 def roscompile_check(input_package, output_package, list_o_functions, subpkg=None, local_config=None):
23 with cases[input_package]
as pkg_in:
24 pkg_out = cases[output_package]
28 root = os.path.join(root, subpkg)
30 for function_name
in list_o_functions:
31 fne = roscompile_functions[function_name]
32 if 'config' in inspect.getargspec(fne).args:
33 fne(pp, config=local_config)
38 matches, missed_deletes, missed_gens = pkg_in.compare_filesets(pkg_out)
39 assert len(missed_deletes) == 0, FILE_ERROR_MESSAGE.format(
'deleted', str(missed_deletes))
40 assert len(missed_gens) == 0, FILE_ERROR_MESSAGE.format(
'generated', str(missed_gens))
41 for filename
in matches:
42 generated_contents = pkg_in.get_contents(filename).strip()
43 canonical_contents = pkg_out.get_contents(filename).strip()
44 assert generated_contents == canonical_contents,
'The contents of {} do not match!'.format(filename)
def roscompile_check(input_package, output_package, list_o_functions, subpkg=None, local_config=None)