6 from .logger
import Logger
10 """ Provides an interface for required test case data. """
15 if bagfile
is not None:
18 if bagfile.startswith(
'~')
or bagfile.startswith(
'/'):
19 bagpath = os.path.expanduser(bagfile)
23 pkgpath = rp.get_path(bagfile.split(
'/')[0])
24 bagpath = os.path.join(pkgpath,
'/'.join(bagfile.split(
'/')[1:]))
26 Logger.print_positive(
'using data source: %s' % bagpath)
29 """ Replace special values according to the specification. """
33 if (isinstance(value, str)
and len(value) > 1
and value[0] ==
'/' and value[1] !=
'/' and
34 self.
_bag is not None):
36 (_, result, _) = list(self.
_bag.read_messages(topics=[value]))[0]
38 (_, result, _) = list(self.
_bag.read_messages(topics=[value[1:]]))[0]
40 elif isinstance(value, str)
and value.startswith(
'lambda '):
46 elif isinstance(value, str)
and len(value) > 1
and value[0] ==
'/' and value[1] ==
'/':
48 except Exception
as e:
49 Logger.print_error(
'unable to parse value "%s" (will be considered as string):\n\t%s' % (