Exemple #1
0
    def __init__(self, base_path, scenarios=None,
                 verbosity=0, no_color=False, random=False,
                 enable_xunit=False, xunit_filename=None,
                 enable_subunit=False, subunit_filename=None,
                 enable_jsonreport=False, jsonreport_filename=None,
                 tags=None, failfast=False, auto_pdb=False,
                 smtp_queue=None, root_dir=None):

        """ lettuce.Runner will try to find a terrain.py file and
        import it from within `base_path`
        """

        self.tags = tags
        self.single_feature = None

        if os.path.isfile(base_path) and os.path.exists(base_path):
            self.single_feature = base_path
            base_path = os.path.dirname(base_path)

        sys.path.insert(0, base_path)
        self.loader = fs.FeatureLoader(base_path, root_dir)
        self.verbosity = verbosity
        self.scenarios = scenarios and map(int, scenarios.split(",")) or None
        self.failfast = failfast
        if auto_pdb:
            autopdb.enable(self)

        sys.path.remove(base_path)

        if verbosity is 0:
            from lettuce.plugins import non_verbose as output
        elif verbosity is 1:
            from lettuce.plugins import dots as output
        elif verbosity is 2:
            from lettuce.plugins import scenario_names as output
        elif verbosity is 3:
            if no_color:
                from lettuce.plugins import shell_output as output
            else:
                from lettuce.plugins import colored_shell_output as output

        self.random = random

        if enable_xunit:
            xunit_output.enable(filename=xunit_filename, tags=tags)
        if smtp_queue:
            smtp_mail_queue.enable()

        if enable_subunit:
            subunit_output.enable(filename=subunit_filename)

        if enable_jsonreport:
            jsonreport_output.enable(filename=jsonreport_filename)

        reload(output)

        self.output = output
Exemple #2
0
    def __init__(self,
                 base_path,
                 scenarios=None,
                 verbosity=0,
                 no_color=False,
                 random=False,
                 enable_xunit=False,
                 xunit_filename=None,
                 enable_subunit=False,
                 subunit_filename=None,
                 enable_jsonreport=False,
                 jsonreport_filename=None,
                 tags=None,
                 failfast=False,
                 auto_pdb=False,
                 smtp_queue=None,
                 root_dir=None):
        """ lettuce.Runner will try to find a terrain.py file and
        import it from within `base_path`
        """

        self.tags = tags
        self.single_feature = None

        if os.path.isfile(base_path) and os.path.exists(base_path):
            self.single_feature = base_path
            base_path = os.path.dirname(base_path)

        sys.path.insert(0, base_path)
        self.loader = fs.FeatureLoader(base_path, root_dir)
        self.verbosity = verbosity
        self.scenarios = scenarios and map(int, scenarios.split(",")) or None
        self.failfast = failfast
        if auto_pdb:
            autopdb.enable(self)

        sys.path.remove(base_path)

        if verbosity is 0:
            from lettuce.plugins import non_verbose as output
        elif verbosity is 1:
            from lettuce.plugins import dots as output
        elif verbosity is 2:
            from lettuce.plugins import scenario_names as output
        else:
            if verbosity is 4:
                from lettuce.plugins import colored_shell_output as output
                msg = ('Deprecated in lettuce 2.2.21. Use verbosity 3 without '
                       '--no-color flag instead of verbosity 4')
                warnings.warn(msg, DeprecationWarning)
            elif verbosity is 3:
                if no_color:
                    from lettuce.plugins import shell_output as output
                else:
                    from lettuce.plugins import colored_shell_output as output

        self.random = random

        if enable_xunit:
            xunit_output.enable(filename=xunit_filename)
        if smtp_queue:
            smtp_mail_queue.enable()

        if enable_subunit:
            subunit_output.enable(filename=subunit_filename)

        if enable_jsonreport:
            jsonreport_output.enable(filename=jsonreport_filename)

        reload(output)

        self.output = output