diff --git a/pysipp/agent.py b/pysipp/agent.py index 1cf2a66..cfb0d43 100644 --- a/pysipp/agent.py +++ b/pysipp/agent.py @@ -55,7 +55,7 @@ def name(self): mediaaddr = tuple_property(('media_addr', 'media_port')) proxyaddr = tuple_property(('proxy_host', 'proxy_port')) ipcaddr = tuple_property(('ipc_host', 'ipc_port')) - call_load = tuple_property(('limit', 'rate', 'call_count')) + call_load = tuple_property(('rate', 'limit', 'call_count')) def __call__(self, block=True, timeout=180, runner=None, raise_exc=True, **kwargs): @@ -103,9 +103,9 @@ def logdir(self): @logdir.setter def logdir(self, dirpath): - assert path.isdir(dirpath) + assert path.isdir(dirpath), '{} is an invalid path'.format(dirpath) for name, attr in self.iter_logfile_items(): - # set all log files + # assemble all log file paths setattr(self, name, path.join(dirpath, "{}_{}".format(self.name, name))) @@ -117,7 +117,7 @@ def logdir(self, dirpath): def plays_media(self, patt='play_pcap_audio'): """Bool determining whether script plays media """ - # FIXME: should be able to parse using -sd + # TODO: should be able to parse using -sd if not self.scen_file: return False diff --git a/pysipp/command.py b/pysipp/command.py index fbd8228..2ac285e 100644 --- a/pysipp/command.py +++ b/pysipp/command.py @@ -137,9 +137,19 @@ def keys(cls): return [key for key, descr in cls.descriptoritems()] def applydict(self, d): - """Apply contents of dict `d` onto local instance variables + """Apply contents of dict `d` onto local instance variables. + Composite attrs (those not found in `_specparams`) are applied + last so that any inter-attr dependencies are (hopefully) resolved. """ + composite = OrderedDict() for name, value in d.items(): + if name not in self._specparams: + composite[name] = value + else: + setattr(self, name, value) + + # apply composites last + for name, value in composite.items(): setattr(self, name, value) def todict(self): diff --git a/pysipp/launch.py b/pysipp/launch.py index ba322da..dc28b12 100644 --- a/pysipp/launch.py +++ b/pysipp/launch.py @@ -146,7 +146,7 @@ def _signalall(self, signum): signalled = OrderedDict() for cmd, proc in self.iterprocs(): proc.send_signal(signum) - log.debug("sent signal '{}' to cmd '{}' with pid '{}'" + log.warn("sent signal '{}' to cmd '{}' with pid '{}'" .format(signum, cmd, proc.pid)) signalled[cmd] = proc return signalled diff --git a/tests/test_stack.py b/tests/test_stack.py index 825bea8..6c8acf8 100644 --- a/tests/test_stack.py +++ b/tests/test_stack.py @@ -87,12 +87,12 @@ def test_unreachable_uas(basic_scen): uas = basic_scen.prepare()[0] logdir = uas.logdir # verify log file generation - for name, path in itertools.chain( - *[tuple(ua.iter_logfile_items()) for ua in basic_scen.prepare()] - ): - assert tempfile.gettempdir() in path - assert logdir in path - assert os.path.isfile(path) + for ua in basic_scen.prepare(): + for name, path in ua.iter_logfile_items(): + assert tempfile.gettempdir() in path + assert ua.name in path + assert logdir in path + assert os.path.isfile(path) # def test_async_run(scenwalk):