Ejemplo n.º 1
0
    def get_nested_part(self):
        """Compute and return a set of test plan ids from nested_part field."""
        nested_parts = []
        if self.nested_part is not None:
            from plainbox.impl.session import SessionManager
            with SessionManager.get_throwaway_manager(self.provider_list) as m:
                context = m.default_device_context
                testplan_ids = []

                class V(Visitor):

                    def visit_Text_node(visitor, node: Text):
                        testplan_ids.append(self.qualify_id(node.text))

                    def visit_Error_node(visitor, node: Error):
                        logger.warning(_(
                            "unable to parse nested_part: %s"), node.msg)

                V().visit(WordList.parse(self.nested_part))
                for tp_id in testplan_ids:
                    try:
                        nested_parts.append(context.get_unit(tp_id, 'test plan'))
                    except KeyError:
                        logger.warning(_(
                            "unable to find nested part: %s"), tp_id)
        return nested_parts
Ejemplo n.º 2
0
 def _print_output_option_list(self):
     print(_("Each format may support a different set of options"))
     with SessionManager.get_throwaway_manager() as manager:
         for name, exporter in manager.exporter_map.items():
             print("{}: {}".format(
                 name,
                 ", ".join(exporter.exporter_cls.supported_option_list)))
Ejemplo n.º 3
0
def get_all_exporter_names():
    """
    Get the identifiers (names) of all the supported session state exporters.

    :returns:
        A list of session exporter names (identifiers) available from all the
        providers.

    This function creates a temporary session associated with the local
    device and adds all of the available providers to it. Finally, it returns
    the list of exporter names. The session is transparently destroyed.
    """
    with SessionManager.get_throwaway_manager() as manager:
        return list(manager.exporter_map.keys())