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