|
1 | 1 | # -*- coding: UTF-8 -*- |
2 | 2 | """ |
3 | | -before_step(context, step), after_step(context, step) |
4 | | - These run before and after every step. |
5 | | - The step passed in is an instance of Step. |
| 3 | +.. code:: |
6 | 4 |
|
7 | | -before_scenario(context, scenario), after_scenario(context, scenario) |
8 | | - These run before and after each scenario is run. |
9 | | - The scenario passed in is an instance of Scenario. |
| 5 | + # -- HOOKS: |
| 6 | + before_step(context, step), after_step(context, step) |
| 7 | + These run before and after every step. |
| 8 | + The step passed in is an instance of Step. |
10 | 9 |
|
11 | | -before_feature(context, feature), after_feature(context, feature) |
12 | | - These run before and after each feature file is exercised. |
13 | | - The feature passed in is an instance of Feature. |
| 10 | + before_scenario(context, scenario), after_scenario(context, scenario) |
| 11 | + These run before and after each scenario is run. |
| 12 | + The scenario passed in is an instance of Scenario. |
14 | 13 |
|
15 | | -before_tag(context, tag), after_tag(context, tag) |
| 14 | + before_feature(context, feature), after_feature(context, feature) |
| 15 | + These run before and after each feature file is exercised. |
| 16 | + The feature passed in is an instance of Feature. |
16 | 17 |
|
| 18 | + before_tag(context, tag), after_tag(context, tag) |
| 19 | + These run before and after any new tag of a model-element. |
17 | 20 | """ |
18 | 21 |
|
| 22 | + |
| 23 | +import behave.active_tag.python |
| 24 | +import behave.active_tag.python_feature |
| 25 | +from behave.fixture import use_fixture_by_tag |
| 26 | +from behave.tag_matcher import ( |
| 27 | + ActiveTagMatcher, setup_active_tag_values, print_active_tags |
| 28 | +) |
| 29 | + |
| 30 | + |
| 31 | +# ----------------------------------------------------------------------------- |
| 32 | +# ACTIVE TAGS: |
| 33 | +# ----------------------------------------------------------------------------- |
| 34 | +# -- MATCHES ANY TAGS: @use.with_{category}={value} |
| 35 | +# NOTE: active_tag_value_provider provides category values for active tags. |
| 36 | +active_tag_value_provider = {} |
| 37 | +active_tag_value_provider.update(behave.active_tag.python.ACTIVE_TAG_VALUE_PROVIDER) |
| 38 | +active_tag_value_provider.update(behave.active_tag.python_feature.ACTIVE_TAG_VALUE_PROVIDER) |
| 39 | +active_tag_matcher = ActiveTagMatcher(active_tag_value_provider) |
| 40 | + |
| 41 | + |
| 42 | +def print_active_tags_summary(): |
| 43 | + print_active_tags(active_tag_value_provider, ["python.version", "os"]) |
| 44 | + |
| 45 | + |
| 46 | +# ----------------------------------------------------------------------------- |
19 | 47 | # -- SETUP: Use cfparse as default matcher |
| 48 | +# ----------------------------------------------------------------------------- |
20 | 49 | # from behave import use_step_matcher |
21 | | -# step_matcher("cfparse") |
| 50 | +# use_step_matcher("cfparse") |
| 51 | + |
22 | 52 |
|
| 53 | +# ----------------------------------------------------------------------------- |
| 54 | +# HOOKS: |
| 55 | +# ----------------------------------------------------------------------------- |
23 | 56 | def before_all(context): |
24 | 57 | context.config.setup_logging() |
| 58 | + print_active_tags_summary() |
0 commit comments