1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
# -*- coding: UTF-8 -*-
from behave.tag_matcher import ActiveTagMatcher, setup_active_tag_values
import sys
# -- MATCHES ANY TAGS: @use.with_{category}={value}
# NOTE: active_tag_value_provider provides category values for active tags.
python_version = "%s.%s" % sys.version_info[:2]
active_tag_value_provider = {
"python.version": python_version,
}
active_tag_matcher = ActiveTagMatcher(active_tag_value_provider)
# -----------------------------------------------------------------------------
# HOOKS:
# -----------------------------------------------------------------------------
def before_all(context):
# -- SETUP ACTIVE-TAG MATCHER (with userdata):
setup_active_tag_values(active_tag_value_provider, context.config.userdata)
def before_feature(context, feature):
if active_tag_matcher.should_exclude_with(feature.tags):
feature.skip(reason=active_tag_matcher.exclude_reason)
def before_scenario(context, scenario):
if active_tag_matcher.should_exclude_with(scenario.effective_tags):
scenario.skip(reason=active_tag_matcher.exclude_reason)
|