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