class TestTagExpressionNoTags(object):
    def setUp(self):
        self.e = TagExpression([])

    def test_should_match_foo(self):
        assert self.e.check(['foo'])

    def test_should_match_empty_tags(self):
        assert self.e.check([])
class TestTagExpressionNotFoo(object):
    def setUp(self):
        self.e = TagExpression(['-foo'])

    def test_should_match_bar(self):
        assert self.e.check(['bar'])

    def test_should_not_match_foo(self):
        assert not self.e.check(['foo'])
class TestTagExpressionNotFooWithTilde(unittest.TestCase):
    def setUp(self):
        self.e = TagExpression(['~foo'])

    def test_should_match_bar(self):
        assert self.e.check(['bar'])

    def test_should_not_match_foo(self):
        assert not self.e.check(['foo'])
class TestTagExpressionFooOrBarAndNotZap(object):
    def setUp(self):
        self.e = TagExpression(['foo,bar', '-zap'])

    def test_should_match_foo(self):
        assert self.e.check(['foo'])

    def test_should_not_match_foo_zap(self):
        assert not self.e.check(['foo', 'zap'])
class TestTagExpressionFooOrBarAndNotZapWithTilde(unittest.TestCase):
    def setUp(self):
        self.e = TagExpression(['foo,bar', '~zap'])

    def test_should_match_foo(self):
        assert self.e.check(['foo'])

    def test_should_not_match_zap(self):
        assert not self.e.check(['zap'])

    def test_should_not_match_foo_zap(self):
        assert not self.e.check(['foo', 'zap'])
class TestTagExpressionFoo(unittest.TestCase):
    def setUp(self):
        self.e = TagExpression(['foo'])

    def test_should_not_match_no_tags(self):
        assert not self.e.check([])

    def test_should_match_foo(self):
        assert self.e.check(['foo'])

    def test_should_not_match_bar(self):
        assert not self.e.check(['bar'])
class TestTagExpressionFoo3OrNotBar4AndZap5(object):
    def setUp(self):
        self.e = TagExpression(['foo:3,-bar', 'zap:5'])

    def test_should_count_tags_for_positive_tags(self):
        tools.eq_(self.e.limits, {'foo': 3, 'zap': 5})

    def test_should_match_foo_zap(self):
        assert self.e.check(['foo', 'zap'])
def normalize_tags(tags):
    # -- STRIP: Leading '@' from tags.
    return [TagExpression.normalize_tag(tag)  for tag in tags]
 def setUp(self):
     self.e = TagExpression(['-foo,-bar'])
Beispiel #10
0
class TestTagExpressionNotFooOrNotBar(unittest.TestCase):
    def setUp(self):
        self.e = TagExpression(['-foo,-bar'])

    def test_should_match_no_tags(self):
        assert self.e.check([])

    def test_should_match_foo(self):
        assert self.e.check(['foo'])

    def test_should_match_bar(self):
        assert self.e.check(['bar'])

    def test_should_match_other(self):
        assert self.e.check(['other'])

    def test_should_not_match_foo_bar(self):
        assert not self.e.check(['foo', 'bar'])
        assert not self.e.check(['bar', 'foo'])

    def test_should_match_foo_other(self):
        assert self.e.check(['foo', 'other'])
        assert self.e.check(['other', 'foo'])

    def test_should_match_bar_other(self):
        assert self.e.check(['bar', 'other'])
        assert self.e.check(['other', 'bar'])

    def test_should_match_zap_other(self):
        assert self.e.check(['zap', 'other'])
        assert self.e.check(['other', 'zap'])

    def test_should_not_match_foo_bar_other(self):
        assert not self.e.check(['foo', 'bar', 'other'])
        assert not self.e.check(['bar', 'other', 'foo'])
        assert not self.e.check(['other', 'bar', 'foo'])

    def test_should_match_foo_zap_other(self):
        assert self.e.check(['foo', 'zap', 'other'])
        assert self.e.check(['other', 'zap', 'foo'])

    def test_should_match_bar_zap_other(self):
        assert self.e.check(['bar', 'zap', 'other'])
        assert self.e.check(['other', 'bar', 'zap'])

    def test_should_match_zap_baz_other(self):
        assert self.e.check(['zap', 'baz', 'other'])
        assert self.e.check(['baz', 'other', 'baz'])
        assert self.e.check(['other', 'baz', 'zap'])
 def test_should_be_counted_for_positive_tags(self):
     e = TagExpression(['todo:3'])
     assert e.limits == {'todo': 3}
 def setUp(self):
     self.e = TagExpression(['foo,bar', '-zap'])
Beispiel #13
0
 def setUp(self):
     self.e = TagExpression([' foo:3 , -bar ', ' zap:5 '])
def convert_tag_expression(text):
    parts = text.strip().split()
    return TagExpression(parts)
class TestTagExpressionFooAndBar(unittest.TestCase):
    # -- LOGIC: @foo and @bar

    def setUp(self):
        self.e = TagExpression(['foo', 'bar'])

    def test_should_not_match_no_tags(self):
        assert not self.e.check([])

    def test_should_not_match_foo(self):
        assert not self.e.check(['foo'])

    def test_should_not_match_bar(self):
        assert not self.e.check(['bar'])

    def test_should_not_match_other(self):
        assert not self.e.check(['other'])

    def test_should_match_foo_bar(self):
        assert self.e.check(['foo', 'bar'])
        assert self.e.check(['bar', 'foo'])

    def test_should_not_match_foo_other(self):
        assert not self.e.check(['foo', 'other'])
        assert not self.e.check(['other', 'foo'])

    def test_should_not_match_bar_other(self):
        assert not self.e.check(['bar', 'other'])
        assert not self.e.check(['other', 'bar'])

    def test_should_not_match_zap_other(self):
        assert not self.e.check(['zap', 'other'])
        assert not self.e.check(['other', 'zap'])

    def test_should_match_foo_bar_other(self):
        assert self.e.check(['foo', 'bar', 'other'])
        assert self.e.check(['bar', 'other', 'foo'])
        assert self.e.check(['other', 'bar', 'foo'])

    def test_should_not_match_foo_zap_other(self):
        assert not self.e.check(['foo', 'zap', 'other'])
        assert not self.e.check(['other', 'zap', 'foo'])

    def test_should_not_match_bar_zap_other(self):
        assert not self.e.check(['bar', 'zap', 'other'])
        assert not self.e.check(['other', 'bar', 'zap'])

    def test_should_not_match_zap_baz_other(self):
        assert not self.e.check(['zap', 'baz', 'other'])
        assert not self.e.check(['baz', 'other', 'baz'])
        assert not self.e.check(['other', 'baz', 'zap'])
Beispiel #16
0
    def __init__(self, command_args=None, load_config=True, verbose=None,
                 **kwargs):
        """
        Constructs a behave configuration object.
          * loads the configuration defaults (if needed).
          * process the command-line args
          * store the configuration results

        :param command_args: Provide command args (as sys.argv).
            If command_args is None, sys.argv[1:] is used.
        :type command_args: list<str>, str
        :param load_config: Indicate if configfile should be loaded (=true)
        :param verbose: Indicate if diagnostic output is enabled
        :param kwargs:  Used to hand-over/overwrite default values.
        """
        if command_args is None:
            command_args = sys.argv[1:]
        elif isinstance(command_args, string_types):
            if isinstance(command_args, unicode):
                command_args = command_args.encode("utf-8")
            command_args = shlex.split(command_args)
        if verbose is None:
            # -- AUTO-DISCOVER: Verbose mode from command-line args.
            verbose = ('-v' in command_args) or ('--verbose' in command_args)

        defaults = self.defaults.copy()
        for name, value in kwargs.items():
            defaults[name] = value
        self.defaults = defaults
        self.formatters = []
        self.reporters = []
        self.name_re = None
        self.outputs = []
        self.include_re = None
        self.exclude_re = None
        self.scenario_outline_annotation_schema = None
        self.steps_dir = "steps"
        self.environment_file = "environment.py"
        self.userdata_defines = None
        if load_config:
            load_configuration(self.defaults, verbose=verbose)
        parser = setup_parser()
        parser.set_defaults(**self.defaults)
        args = parser.parse_args(command_args)
        for key, value in args.__dict__.items():
            if key.startswith('_') and key not in self.cmdline_only_options:
                continue
            setattr(self, key, value)

        self.paths = [os.path.normpath(path) for path in self.paths]
        if not args.outfiles:
            self.outputs.append(StreamOpener(stream=sys.stdout))
        else:
            for outfile in args.outfiles:
                if outfile and outfile != '-':
                    self.outputs.append(StreamOpener(outfile))
                else:
                    self.outputs.append(StreamOpener(stream=sys.stdout))

        if self.wip:
            # Only run scenarios tagged with "wip".
            # Additionally:
            #  * use the "plain" formatter (per default)
            #  * do not capture stdout or logging output and
            #  * stop at the first failure.
            self.default_format = "plain"
            self.tags = ["wip"]
            self.color = False
            self.stop = True
            self.log_capture = False
            self.stdout_capture = False

        self.tags = TagExpression(self.tags or [])

        if self.quiet:
            self.show_source = False
            self.show_snippets = False

        if self.exclude_re:
            self.exclude_re = re.compile(self.exclude_re)

        if self.include_re:
            self.include_re = re.compile(self.include_re)
        if self.name:
            # -- SELECT: Scenario-by-name, build regular expression.
            self.name_re = self.build_name_re(self.name)

        if self.junit:
            # Buffer the output (it will be put into Junit report)
            self.stdout_capture = True
            self.stderr_capture = True
            self.log_capture = True
            self.reporters.append(JUnitReporter(self))
        if self.summary:
            self.reporters.append(SummaryReporter(self))

        unknown_formats = self.collect_unknown_formats()
        if unknown_formats:
            parser.error("format=%s is unknown" % ", ".join(unknown_formats))

        if self.stage is None:
            # -- USE ENVIRONMENT-VARIABLE, if stage is undefined.
            self.stage = os.environ.get("BEHAVE_STAGE", None)
        self.setup_stage(self.stage)
        self.setup_model()
        self.setup_userdata()
Beispiel #17
0
    def __init__(self):
        self.formatters = []
        self.reporters = []
        self.name_re = None
        self.outputs = []
        load_configuration(self.defaults)
        parser.set_defaults(**self.defaults)

        args = parser.parse_args()
        for key, value in args.__dict__.items():
            if key.startswith('_'):
                continue
            setattr(self, key, value)

        self.paths = [os.path.normpath(path) for path in self.paths]
        if not args.outfiles:
            self.outputs.append(StreamOpener(stream=sys.stdout))
        else:
            for outfile in args.outfiles:
                if outfile and outfile != '-':
                    self.outputs.append(StreamOpener(outfile))
                else:
                    self.outputs.append(StreamOpener(stream=sys.stdout))

        if self.wip:
            # Only run scenarios tagged with "wip". Additionally: use the
            # "plain" formatter, do not capture stdout or logging output and
            # stop at the first failure.
            self.format = ['plain']
            self.tags = ['wip']
            self.stop = True
            self.log_capture = False
            self.stdout_capture = False

        self.tags = TagExpression(self.tags or [])

        if self.quiet:
            self.show_source = False
            self.show_snippets = False

        if self.exclude_re:
            self.exclude_re = re.compile(self.exclude_re)

        if self.include_re:
            self.include_re = re.compile(self.include_re)
        if self.name:
            # -- SELECT: Scenario-by-name, build regular expression.
            self.name_re = self.build_name_re(self.name)

        if self.junit:
            # Buffer the output (it will be put into Junit report)
            self.stdout_capture = True
            self.stderr_capture = True
            self.log_capture = True
            self.reporters.append(JUnitReporter(self))
        if self.summary:
            self.reporters.append(SummaryReporter(self))

        unknown_formats = self.collect_unknown_formats()
        if unknown_formats:
            parser.error("format=%s is unknown" % ", ".join(unknown_formats))
Beispiel #18
0
 def test_should_allow_duplicate_consistent_limits(self):
     e = TagExpression(['todo:3', '-todo:3'])
     tools.eq_(e.limits, {'todo': 3})
Beispiel #19
0
 def test_should_be_counted_for_positive_tags(self):
     e = TagExpression(['todo:3'])
     tools.eq_(e.limits, {'todo': 3})
 def test_should_raise_an_error_for_inconsistent_limits(self):
     with pytest.raises(Exception):
         _ = TagExpression(['todo:3', '-todo:4'])
 def test_should_allow_duplicate_consistent_limits(self):
     e = TagExpression(['todo:3', '-todo:3'])
     assert e.limits == {'todo': 3}
def normalize_tags(tags):
    # -- STRIP: Leading '@' from tags.
    return [TagExpression.normalize_tag(tag) for tag in tags]
Beispiel #23
0
 def setUp(self):
     self.e = TagExpression(['foo,bar', '-zap'])
class TestTagExpressionFooOrBarAndNotZap(unittest.TestCase):
    def setUp(self):
        self.e = TagExpression(['foo,bar', '-zap'])

    def test_should_match_foo(self):
        assert self.e.check(['foo'])

    def test_should_not_match_foo_zap(self):
        assert not self.e.check(['foo', 'zap'])

    def test_should_not_match_tags(self):
        assert not self.e.check([])

    def test_should_match_foo(self):
        assert self.e.check(['foo'])

    def test_should_match_bar(self):
        assert self.e.check(['bar'])

    def test_should_not_match_other(self):
        assert not self.e.check(['other'])

    def test_should_match_foo_bar(self):
        assert self.e.check(['foo', 'bar'])
        assert self.e.check(['bar', 'foo'])

    def test_should_match_foo_other(self):
        assert self.e.check(['foo', 'other'])
        assert self.e.check(['other', 'foo'])

    def test_should_match_bar_other(self):
        assert self.e.check(['bar', 'other'])
        assert self.e.check(['other', 'bar'])

    def test_should_not_match_zap_other(self):
        assert not self.e.check(['zap', 'other'])
        assert not self.e.check(['other', 'zap'])

    def test_should_match_foo_bar_other(self):
        assert self.e.check(['foo', 'bar', 'other'])
        assert self.e.check(['bar', 'other', 'foo'])
        assert self.e.check(['other', 'bar', 'foo'])

    def test_should_not_match_foo_bar_zap(self):
        assert not self.e.check(['foo', 'bar', 'zap'])
        assert not self.e.check(['bar', 'zap', 'foo'])
        assert not self.e.check(['zap', 'bar', 'foo'])

    def test_should_not_match_foo_zap_other(self):
        assert not self.e.check(['foo', 'zap', 'other'])
        assert not self.e.check(['other', 'zap', 'foo'])

    def test_should_not_match_bar_zap_other(self):
        assert not self.e.check(['bar', 'zap', 'other'])
        assert not self.e.check(['other', 'bar', 'zap'])

    def test_should_not_match_zap_baz_other(self):
        assert not self.e.check(['zap', 'baz', 'other'])
        assert not self.e.check(['baz', 'other', 'baz'])
        assert not self.e.check(['other', 'baz', 'zap'])
Beispiel #25
0
    def __init__(self):
        self.formatters = []
        self.reporters = []

        defaults = dict(
            color=sys.platform != 'win32',
            stdout_capture=True,
            stderr_capture=True,
            show_snippets=True,
            show_skipped=True,
            log_capture=True,
            dry_run=False,
            show_source=True,
            logging_format='%(levelname)s:%(name)s:%(message)s',
            summary=True,
            junit=False,
        )
        load_configuration(defaults)
        parser.set_defaults(**defaults)

        args = parser.parse_args()
        for key, value in args.__dict__.items():
            if key.startswith('_'):
                continue
            setattr(self, key, value)

        if args.outfile and args.outfile != '-':
            self.output = open(args.outfile, 'w')
        else:
            self.output = sys.stdout

        if self.wip:
            # Only run scenarios tagged with "wip". Additionally: use the
            # "plain" formatter, do not capture stdout or logging output and
            # stop at the first failure.
            self.format = ['plain']
            self.tags = ['wip']
            self.stop = True
            self.log_capture = False
            self.stdout_capture = False

        self.tags = TagExpression(self.tags or [])

        if self.quiet:
            self.show_source = False
            self.show_snippets = False

        if self.exclude_re:
            self.exclude_re = re.compile(self.exclude_re)

        if self.include_re:
            self.include_re = re.compile(self.include_re)

        if self.junit:
            # Buffer the output (it will be put into Junit report)
            self.stdout_capture = True
            self.stderr_capture = True
            self.log_capture = True
            self.reporters.append(JUnitReporter(self))
        if self.summary:
            self.reporters.append(SummaryReporter(self))
 def setUp(self):
     self.e = TagExpression(['foo', 'bar'])
Beispiel #27
0
    def __init__(self,
                 command_args=None,
                 load_config=True,
                 verbose=None,
                 **kwargs):
        """
        Constructs a behave configuration object.
          * loads the configuration defaults (if needed).
          * process the command-line args
          * store the configuration results

        :param command_args: Provide command args (as sys.argv).
            If command_args is None, sys.argv[1:] is used.
        :type command_args: list<str>, str
        :param load_config: Indicate if configfile should be loaded (=true)
        :param verbose: Indicate if diagnostic output is enabled
        :param kwargs:  Used to hand-over/overwrite default values.
        """
        # pylint: disable=too-many-branches, too-many-statements
        if command_args is None:
            command_args = sys.argv[1:]
        elif isinstance(command_args, six.string_types):
            encoding = select_best_encoding() or "utf-8"
            if six.PY2 and isinstance(command_args, six.text_type):
                command_args = command_args.encode(encoding)
            elif six.PY3 and isinstance(command_args, six.binary_type):
                command_args = command_args.decode(encoding)
            command_args = shlex.split(command_args)
        elif isinstance(command_args, (list, tuple)):
            command_args = to_texts(command_args)

        if verbose is None:
            # -- AUTO-DISCOVER: Verbose mode from command-line args.
            verbose = ("-v" in command_args) or ("--verbose" in command_args)

        self.version = None
        self.tags_help = None
        self.lang_list = None
        self.lang_help = None
        self.default_tags = None
        self.junit = None
        self.logging_format = None
        self.logging_datefmt = None
        self.name = None
        self.scope = None
        self.steps_catalog = None
        self.userdata = None
        self.wip = None

        defaults = self.defaults.copy()
        for name, value in six.iteritems(kwargs):
            defaults[name] = value
        self.defaults = defaults
        self.formatters = []
        self.reporters = []
        self.name_re = None
        self.outputs = []
        self.include_re = None
        self.exclude_re = None
        self.scenario_outline_annotation_schema = None  # pylint: disable=invalid-name
        self.steps_dir = "steps"
        self.environment_file = "environment.py"
        self.userdata_defines = None
        self.more_formatters = None
        if load_config:
            load_configuration(self.defaults, verbose=verbose)
        parser = setup_parser()
        parser.set_defaults(**self.defaults)
        args = parser.parse_args(command_args)
        for key, value in six.iteritems(args.__dict__):
            if key.startswith("_") and key not in self.cmdline_only_options:
                continue
            setattr(self, key, value)

        self.paths = [os.path.normpath(path) for path in self.paths]
        self.setup_outputs(args.outfiles)

        if self.steps_catalog:
            # -- SHOW STEP-CATALOG: As step summary.
            self.default_format = "steps.catalog"
            self.format = ["steps.catalog"]
            self.dry_run = True
            self.summary = False
            self.show_skipped = False
            self.quiet = True

        if self.wip:
            # Only run scenarios tagged with "wip".
            # Additionally:
            #  * use the "plain" formatter (per default)
            #  * do not capture stdout or logging output and
            #  * stop at the first failure.
            self.default_format = "plain"
            self.tags = ["wip"] + self.default_tags.split()
            self.color = False
            self.stop = True
            self.log_capture = False
            self.stdout_capture = False

        self.tags = TagExpression(self.tags or self.default_tags.split())

        if self.quiet:
            self.show_source = False
            self.show_snippets = False

        if self.exclude_re:
            self.exclude_re = re.compile(self.exclude_re)

        if self.include_re:
            self.include_re = re.compile(self.include_re)
        if self.name:
            # -- SELECT: Scenario-by-name, build regular expression.
            self.name_re = self.build_name_re(self.name)

        if self.stage is None:  # pylint: disable=access-member-before-definition
            # -- USE ENVIRONMENT-VARIABLE, if stage is undefined.
            self.stage = os.environ.get("BEHAVE_STAGE", None)
        self.setup_stage(self.stage)
        self.setup_model()
        self.setup_userdata()

        # -- FINALLY: Setup Reporters and Formatters
        # NOTE: Reporters and Formatters can now use userdata information.
        if self.junit:
            # Buffer the output (it will be put into Junit report)
            self.stdout_capture = True
            self.stderr_capture = True
            self.log_capture = True
            self.reporters.append(JUnitReporter(self))
        if self.summary:
            self.reporters.append(SummaryReporter(self))

        self.setup_formats()
        unknown_formats = self.collect_unknown_formats()
        if unknown_formats:
            parser.error("format=%s is unknown" % ", ".join(unknown_formats))
 def setUp(self):
     self.e = TagExpression(['-foo'])
Beispiel #29
0
class TestTagExpressionFooAndNotBar(unittest.TestCase):
    # -- LOGIC: @foo and not @bar

    def setUp(self):
        self.e = TagExpression(['foo', '-bar'])

    def test_should_not_match_no_tags(self):
        assert not self.e.check([])

    def test_should_match_foo(self):
        assert self.e.check(['foo'])

    def test_should_not_match_bar(self):
        assert not self.e.check(['bar'])

    def test_should_not_match_other(self):
        assert not self.e.check(['other'])

    def test_should_not_match_foo_bar(self):
        assert not self.e.check(['foo', 'bar'])
        assert not self.e.check(['bar', 'foo'])

    def test_should_match_foo_other(self):
        assert self.e.check(['foo', 'other'])
        assert self.e.check(['other', 'foo'])

    def test_should_not_match_bar_other(self):
        assert not self.e.check(['bar', 'other'])
        assert not self.e.check(['other', 'bar'])

    def test_should_not_match_zap_other(self):
        assert not self.e.check(['bar', 'other'])
        assert not self.e.check(['other', 'bar'])

    def test_should_not_match_foo_bar_other(self):
        assert not self.e.check(['foo', 'bar', 'other'])
        assert not self.e.check(['bar', 'other', 'foo'])
        assert not self.e.check(['other', 'bar', 'foo'])

    def test_should_match_foo_zap_other(self):
        assert self.e.check(['foo', 'zap', 'other'])
        assert self.e.check(['other', 'zap', 'foo'])

    def test_should_not_match_bar_zap_other(self):
        assert not self.e.check(['bar', 'zap', 'other'])
        assert not self.e.check(['other', 'bar', 'zap'])

    def test_should_not_match_zap_baz_other(self):
        assert not self.e.check(['zap', 'baz', 'other'])
        assert not self.e.check(['baz', 'other', 'baz'])
        assert not self.e.check(['other', 'baz', 'zap'])
Beispiel #30
0
 def setUp(self):
     self.e = TagExpression(['foo', '-bar'])
Beispiel #31
0
 def setUp(self):
     self.e = TagExpression([])
 def setUp(self):
     self.e = TagExpression([])
Beispiel #33
0
 def setUp(self):
     self.e = TagExpression(['-bar,foo'])
 def setUp(self):
     self.e = TagExpression(['foo:3,-bar', 'zap:5'])
    def __init__(self, command_args=None, verbose=None):
        """
        Constructs a behave configuration object.
          * loads the configuration defaults.
          * process the command-line args
          * store the configuration results

        :param command_args: Provide command args (as sys.argv).
            If command_args is None, sys.argv[1:] is used.
        :type command_args: list<str>, str
        :param verbose: Indicate if diagnostic output is enabled
        """
        if command_args is None:
            command_args = sys.argv[1:]
        elif isinstance(command_args, basestring):
            command_args = shlex.split(command_args)
        if verbose is None:
            # -- AUTO-DISCOVER: Verbose mode from command-line args.
            verbose = ('-v' in command_args) or ('--verbose' in command_args)

        self.formatters = []
        self.reporters = []
        self.name_re = None
        self.outputs = []
        self.include_re = None
        self.exclude_re = None
        load_configuration(self.defaults, verbose=verbose)
        parser.set_defaults(**self.defaults)
        args = parser.parse_args(command_args)
        for key, value in args.__dict__.items():
            if key.startswith('_'):
                continue
            setattr(self, key, value)

        self.paths = [os.path.normpath(path) for path in self.paths]
        if not args.outfiles:
            self.outputs.append(StreamOpener(stream=sys.stdout))
        else:
            for outfile in args.outfiles:
                if outfile and outfile != '-':
                    self.outputs.append(StreamOpener(outfile))
                else:
                    self.outputs.append(StreamOpener(stream=sys.stdout))

        if self.wip:
            # Only run scenarios tagged with "wip". Additionally: use the
            # "plain" formatter, do not capture stdout or logging output and
            # stop at the first failure.
            self.format = ['plain']
            self.tags = ['wip']
            self.stop = True
            self.log_capture = False
            self.stdout_capture = False

        self.tags = TagExpression(self.tags or [])

        if self.quiet:
            self.show_source = False
            self.show_snippets = False

        if self.exclude_re:
            self.exclude_re = re.compile(self.exclude_re)

        if self.include_re:
            self.include_re = re.compile(self.include_re)
        if self.name:
            # -- SELECT: Scenario-by-name, build regular expression.
            self.name_re = self.build_name_re(self.name)

        if self.junit:
            # Buffer the output (it will be put into Junit report)
            self.stdout_capture = True
            self.stderr_capture = True
            self.log_capture = True
            self.reporters.append(JUnitReporter(self))
        if self.summary:
            self.reporters.append(SummaryReporter(self))

        unknown_formats = self.collect_unknown_formats()
        if unknown_formats:
            parser.error("format=%s is unknown" % ", ".join(unknown_formats))