busser-behave 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.cane +0 -0
- data/.gitignore +17 -0
- data/.tailor +4 -0
- data/.travis.yml +11 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +3 -0
- data/LICENSE +15 -0
- data/README.md +41 -0
- data/Rakefile +68 -0
- data/busser-behave.gemspec +30 -0
- data/features/plugin_install_command.feature +11 -0
- data/features/plugin_list_command.feature +8 -0
- data/features/support/env.rb +13 -0
- data/features/test_command.feature +31 -0
- data/lib/busser/behave/version.rb +26 -0
- data/lib/busser/runner_plugin/behave.rb +37 -0
- data/vendor/behave/CHANGES.rst +483 -0
- data/vendor/behave/LICENSE +23 -0
- data/vendor/behave/MANIFEST.in +37 -0
- data/vendor/behave/PROJECT_INFO.rst +21 -0
- data/vendor/behave/README.rst +112 -0
- data/vendor/behave/VERSION.txt +1 -0
- data/vendor/behave/behave.ini +22 -0
- data/vendor/behave/behave/__init__.py +30 -0
- data/vendor/behave/behave/__main__.py +187 -0
- data/vendor/behave/behave/_stepimport.py +185 -0
- data/vendor/behave/behave/_types.py +134 -0
- data/vendor/behave/behave/api/__init__.py +7 -0
- data/vendor/behave/behave/api/async_step.py +283 -0
- data/vendor/behave/behave/capture.py +227 -0
- data/vendor/behave/behave/compat/__init__.py +5 -0
- data/vendor/behave/behave/compat/collections.py +20 -0
- data/vendor/behave/behave/configuration.py +788 -0
- data/vendor/behave/behave/contrib/__init__.py +0 -0
- data/vendor/behave/behave/contrib/scenario_autoretry.py +73 -0
- data/vendor/behave/behave/formatter/__init__.py +12 -0
- data/vendor/behave/behave/formatter/_builtins.py +39 -0
- data/vendor/behave/behave/formatter/_registry.py +135 -0
- data/vendor/behave/behave/formatter/ansi_escapes.py +91 -0
- data/vendor/behave/behave/formatter/base.py +200 -0
- data/vendor/behave/behave/formatter/formatters.py +57 -0
- data/vendor/behave/behave/formatter/json.py +253 -0
- data/vendor/behave/behave/formatter/null.py +12 -0
- data/vendor/behave/behave/formatter/plain.py +158 -0
- data/vendor/behave/behave/formatter/pretty.py +351 -0
- data/vendor/behave/behave/formatter/progress.py +287 -0
- data/vendor/behave/behave/formatter/rerun.py +114 -0
- data/vendor/behave/behave/formatter/sphinx_steps.py +372 -0
- data/vendor/behave/behave/formatter/sphinx_util.py +118 -0
- data/vendor/behave/behave/formatter/steps.py +497 -0
- data/vendor/behave/behave/formatter/tags.py +178 -0
- data/vendor/behave/behave/i18n.py +614 -0
- data/vendor/behave/behave/importer.py +102 -0
- data/vendor/behave/behave/json_parser.py +264 -0
- data/vendor/behave/behave/log_capture.py +233 -0
- data/vendor/behave/behave/matchers.py +402 -0
- data/vendor/behave/behave/model.py +1737 -0
- data/vendor/behave/behave/model_core.py +416 -0
- data/vendor/behave/behave/model_describe.py +105 -0
- data/vendor/behave/behave/parser.py +615 -0
- data/vendor/behave/behave/reporter/__init__.py +0 -0
- data/vendor/behave/behave/reporter/base.py +45 -0
- data/vendor/behave/behave/reporter/junit.py +473 -0
- data/vendor/behave/behave/reporter/summary.py +94 -0
- data/vendor/behave/behave/runner.py +753 -0
- data/vendor/behave/behave/runner_util.py +417 -0
- data/vendor/behave/behave/step_registry.py +112 -0
- data/vendor/behave/behave/tag_expression.py +111 -0
- data/vendor/behave/behave/tag_matcher.py +465 -0
- data/vendor/behave/behave/textutil.py +137 -0
- data/vendor/behave/behave/userdata.py +130 -0
- data/vendor/behave/behave4cmd0/__all_steps__.py +12 -0
- data/vendor/behave/behave4cmd0/__init__.py +5 -0
- data/vendor/behave/behave4cmd0/__setup.py +11 -0
- data/vendor/behave/behave4cmd0/command_shell.py +216 -0
- data/vendor/behave/behave4cmd0/command_shell_proc.py +256 -0
- data/vendor/behave/behave4cmd0/command_steps.py +532 -0
- data/vendor/behave/behave4cmd0/command_util.py +147 -0
- data/vendor/behave/behave4cmd0/failing_steps.py +49 -0
- data/vendor/behave/behave4cmd0/log/__init__.py +1 -0
- data/vendor/behave/behave4cmd0/log/steps.py +395 -0
- data/vendor/behave/behave4cmd0/note_steps.py +29 -0
- data/vendor/behave/behave4cmd0/passing_steps.py +36 -0
- data/vendor/behave/behave4cmd0/pathutil.py +146 -0
- data/vendor/behave/behave4cmd0/setup_command_shell.py +24 -0
- data/vendor/behave/behave4cmd0/textutil.py +304 -0
- data/vendor/behave/bin/behave +44 -0
- data/vendor/behave/bin/behave.cmd +10 -0
- data/vendor/behave/bin/behave.junit_filter.py +85 -0
- data/vendor/behave/bin/behave.step_durations.py +163 -0
- data/vendor/behave/bin/behave2cucumber_json.py +63 -0
- data/vendor/behave/bin/behave_cmd.py +44 -0
- data/vendor/behave/bin/convert_i18n_yaml.py +77 -0
- data/vendor/behave/bin/explore_platform_encoding.py +24 -0
- data/vendor/behave/bin/i18n.yml +621 -0
- data/vendor/behave/bin/invoke +8 -0
- data/vendor/behave/bin/invoke.cmd +9 -0
- data/vendor/behave/bin/json.format.py +167 -0
- data/vendor/behave/bin/jsonschema_validate.py +122 -0
- data/vendor/behave/bin/make_localpi.py +279 -0
- data/vendor/behave/bin/project_bootstrap.sh +30 -0
- data/vendor/behave/bin/toxcmd.py +270 -0
- data/vendor/behave/bin/toxcmd3.py +270 -0
- data/vendor/behave/conftest.py +27 -0
- data/vendor/behave/docs/Makefile +154 -0
- data/vendor/behave/docs/_static/agogo.css +501 -0
- data/vendor/behave/docs/_static/behave_logo.png +0 -0
- data/vendor/behave/docs/_static/behave_logo1.png +0 -0
- data/vendor/behave/docs/_static/behave_logo2.png +0 -0
- data/vendor/behave/docs/_static/behave_logo3.png +0 -0
- data/vendor/behave/docs/_themes/LICENSE +45 -0
- data/vendor/behave/docs/_themes/kr/layout.html +17 -0
- data/vendor/behave/docs/_themes/kr/relations.html +19 -0
- data/vendor/behave/docs/_themes/kr/static/flasky.css_t +480 -0
- data/vendor/behave/docs/_themes/kr/static/small_flask.css +90 -0
- data/vendor/behave/docs/_themes/kr/theme.conf +7 -0
- data/vendor/behave/docs/_themes/kr_small/layout.html +22 -0
- data/vendor/behave/docs/_themes/kr_small/static/flasky.css_t +287 -0
- data/vendor/behave/docs/_themes/kr_small/theme.conf +10 -0
- data/vendor/behave/docs/api.rst +408 -0
- data/vendor/behave/docs/appendix.rst +19 -0
- data/vendor/behave/docs/behave.rst +640 -0
- data/vendor/behave/docs/behave.rst-template +86 -0
- data/vendor/behave/docs/behave_ecosystem.rst +81 -0
- data/vendor/behave/docs/comparison.rst +85 -0
- data/vendor/behave/docs/conf.py +293 -0
- data/vendor/behave/docs/context_attributes.rst +66 -0
- data/vendor/behave/docs/django.rst +192 -0
- data/vendor/behave/docs/formatters.rst +61 -0
- data/vendor/behave/docs/gherkin.rst +673 -0
- data/vendor/behave/docs/index.rst +57 -0
- data/vendor/behave/docs/install.rst +60 -0
- data/vendor/behave/docs/more_info.rst +184 -0
- data/vendor/behave/docs/new_and_noteworthy.rst +18 -0
- data/vendor/behave/docs/new_and_noteworthy_v1.2.4.rst +11 -0
- data/vendor/behave/docs/new_and_noteworthy_v1.2.5.rst +814 -0
- data/vendor/behave/docs/new_and_noteworthy_v1.2.6.rst +255 -0
- data/vendor/behave/docs/parse_builtin_types.rst +59 -0
- data/vendor/behave/docs/philosophy.rst +235 -0
- data/vendor/behave/docs/regular_expressions.rst +71 -0
- data/vendor/behave/docs/related.rst +14 -0
- data/vendor/behave/docs/test_domains.rst +62 -0
- data/vendor/behave/docs/tutorial.rst +636 -0
- data/vendor/behave/docs/update_behave_rst.py +100 -0
- data/vendor/behave/etc/json/behave.json-schema +172 -0
- data/vendor/behave/etc/junit.xml/behave_junit.xsd +103 -0
- data/vendor/behave/etc/junit.xml/junit-4.xsd +92 -0
- data/vendor/behave/examples/async_step/README.txt +8 -0
- data/vendor/behave/examples/async_step/behave.ini +14 -0
- data/vendor/behave/examples/async_step/features/async_dispatch.feature +8 -0
- data/vendor/behave/examples/async_step/features/async_run.feature +6 -0
- data/vendor/behave/examples/async_step/features/environment.py +28 -0
- data/vendor/behave/examples/async_step/features/steps/async_dispatch_steps.py +26 -0
- data/vendor/behave/examples/async_step/features/steps/async_steps34.py +10 -0
- data/vendor/behave/examples/async_step/features/steps/async_steps35.py +10 -0
- data/vendor/behave/examples/async_step/testrun_example.async_dispatch.txt +11 -0
- data/vendor/behave/examples/async_step/testrun_example.async_run.txt +9 -0
- data/vendor/behave/examples/env_vars/README.rst +26 -0
- data/vendor/behave/examples/env_vars/behave.ini +15 -0
- data/vendor/behave/examples/env_vars/behave_run.output_example.txt +12 -0
- data/vendor/behave/examples/env_vars/features/env_var.feature +6 -0
- data/vendor/behave/examples/env_vars/features/steps/env_var_steps.py +38 -0
- data/vendor/behave/features/README.txt +12 -0
- data/vendor/behave/features/background.feature +392 -0
- data/vendor/behave/features/capture_stderr.feature +172 -0
- data/vendor/behave/features/capture_stdout.feature +125 -0
- data/vendor/behave/features/cmdline.lang_list.feature +33 -0
- data/vendor/behave/features/configuration.default_paths.feature +116 -0
- data/vendor/behave/features/context.global_params.feature +35 -0
- data/vendor/behave/features/context.local_params.feature +17 -0
- data/vendor/behave/features/directory_layout.advanced.feature +147 -0
- data/vendor/behave/features/directory_layout.basic.feature +75 -0
- data/vendor/behave/features/directory_layout.basic2.feature +87 -0
- data/vendor/behave/features/environment.py +53 -0
- data/vendor/behave/features/exploratory_testing.with_table.feature +141 -0
- data/vendor/behave/features/feature.description.feature +0 -0
- data/vendor/behave/features/feature.exclude_from_run.feature +96 -0
- data/vendor/behave/features/formatter.help.feature +30 -0
- data/vendor/behave/features/formatter.json.feature +420 -0
- data/vendor/behave/features/formatter.progress3.feature +235 -0
- data/vendor/behave/features/formatter.rerun.feature +296 -0
- data/vendor/behave/features/formatter.steps.feature +181 -0
- data/vendor/behave/features/formatter.steps_catalog.feature +100 -0
- data/vendor/behave/features/formatter.steps_doc.feature +140 -0
- data/vendor/behave/features/formatter.steps_usage.feature +404 -0
- data/vendor/behave/features/formatter.tags.feature +134 -0
- data/vendor/behave/features/formatter.tags_location.feature +183 -0
- data/vendor/behave/features/formatter.user_defined.feature +196 -0
- data/vendor/behave/features/i18n.unicode_problems.feature +445 -0
- data/vendor/behave/features/logcapture.clear_handlers.feature +114 -0
- data/vendor/behave/features/logcapture.feature +188 -0
- data/vendor/behave/features/logcapture.filter.feature +130 -0
- data/vendor/behave/features/logging.no_capture.feature +99 -0
- data/vendor/behave/features/logging.setup_format.feature +157 -0
- data/vendor/behave/features/logging.setup_level.feature +168 -0
- data/vendor/behave/features/logging.setup_with_configfile.feature +137 -0
- data/vendor/behave/features/parser.background.sad_cases.feature +129 -0
- data/vendor/behave/features/parser.feature.sad_cases.feature +144 -0
- data/vendor/behave/features/runner.abort_by_user.feature +305 -0
- data/vendor/behave/features/runner.continue_after_failed_step.feature +136 -0
- data/vendor/behave/features/runner.default_format.feature +175 -0
- data/vendor/behave/features/runner.dry_run.feature +184 -0
- data/vendor/behave/features/runner.feature_listfile.feature +223 -0
- data/vendor/behave/features/runner.hook_errors.feature +382 -0
- data/vendor/behave/features/runner.multiple_formatters.feature +285 -0
- data/vendor/behave/features/runner.scenario_autoretry.feature +131 -0
- data/vendor/behave/features/runner.select_files_by_regexp.example.feature +71 -0
- data/vendor/behave/features/runner.select_files_by_regexp.feature +84 -0
- data/vendor/behave/features/runner.select_scenarios_by_file_location.feature +403 -0
- data/vendor/behave/features/runner.select_scenarios_by_name.feature +289 -0
- data/vendor/behave/features/runner.select_scenarios_by_tag.feature +225 -0
- data/vendor/behave/features/runner.stop_after_failure.feature +122 -0
- data/vendor/behave/features/runner.tag_logic.feature +67 -0
- data/vendor/behave/features/runner.unknown_formatter.feature +23 -0
- data/vendor/behave/features/runner.use_stage_implementations.feature +126 -0
- data/vendor/behave/features/scenario.description.feature +171 -0
- data/vendor/behave/features/scenario.exclude_from_run.feature +217 -0
- data/vendor/behave/features/scenario_outline.basics.feature +100 -0
- data/vendor/behave/features/scenario_outline.improved.feature +177 -0
- data/vendor/behave/features/scenario_outline.name_annotation.feature +157 -0
- data/vendor/behave/features/scenario_outline.parametrized.feature +401 -0
- data/vendor/behave/features/scenario_outline.tagged_examples.feature +118 -0
- data/vendor/behave/features/step.async_steps.feature +225 -0
- data/vendor/behave/features/step.duplicated_step.feature +106 -0
- data/vendor/behave/features/step.execute_steps.feature +59 -0
- data/vendor/behave/features/step.execute_steps.with_table.feature +65 -0
- data/vendor/behave/features/step.import_other_step_module.feature +103 -0
- data/vendor/behave/features/step.pending_steps.feature +128 -0
- data/vendor/behave/features/step.undefined_steps.feature +307 -0
- data/vendor/behave/features/step.use_step_library.feature +44 -0
- data/vendor/behave/features/step_dialect.generic_steps.feature +189 -0
- data/vendor/behave/features/step_dialect.given_when_then.feature +89 -0
- data/vendor/behave/features/step_param.builtin_types.with_float.feature +239 -0
- data/vendor/behave/features/step_param.builtin_types.with_integer.feature +305 -0
- data/vendor/behave/features/step_param.custom_types.feature +134 -0
- data/vendor/behave/features/steps/behave_active_tags_steps.py +86 -0
- data/vendor/behave/features/steps/behave_context_steps.py +67 -0
- data/vendor/behave/features/steps/behave_model_tag_logic_steps.py +105 -0
- data/vendor/behave/features/steps/behave_model_util.py +105 -0
- data/vendor/behave/features/steps/behave_select_files_steps.py +83 -0
- data/vendor/behave/features/steps/behave_tag_expression_steps.py +166 -0
- data/vendor/behave/features/steps/behave_undefined_steps.py +101 -0
- data/vendor/behave/features/steps/use_steplib_behave4cmd.py +12 -0
- data/vendor/behave/features/summary.undefined_steps.feature +114 -0
- data/vendor/behave/features/tags.active_tags.feature +385 -0
- data/vendor/behave/features/tags.default_tags.feature +104 -0
- data/vendor/behave/features/tags.tag_expression.feature +105 -0
- data/vendor/behave/features/userdata.feature +331 -0
- data/vendor/behave/invoke.yaml +21 -0
- data/vendor/behave/issue.features/README.txt +17 -0
- data/vendor/behave/issue.features/environment.py +97 -0
- data/vendor/behave/issue.features/issue0030.feature +21 -0
- data/vendor/behave/issue.features/issue0031.feature +16 -0
- data/vendor/behave/issue.features/issue0032.feature +28 -0
- data/vendor/behave/issue.features/issue0035.feature +74 -0
- data/vendor/behave/issue.features/issue0040.feature +154 -0
- data/vendor/behave/issue.features/issue0041.feature +135 -0
- data/vendor/behave/issue.features/issue0042.feature +230 -0
- data/vendor/behave/issue.features/issue0044.feature +51 -0
- data/vendor/behave/issue.features/issue0046.feature +77 -0
- data/vendor/behave/issue.features/issue0052.feature +66 -0
- data/vendor/behave/issue.features/issue0059.feature +29 -0
- data/vendor/behave/issue.features/issue0063.feature +102 -0
- data/vendor/behave/issue.features/issue0064.feature +97 -0
- data/vendor/behave/issue.features/issue0065.feature +18 -0
- data/vendor/behave/issue.features/issue0066.feature +80 -0
- data/vendor/behave/issue.features/issue0067.feature +90 -0
- data/vendor/behave/issue.features/issue0069.feature +64 -0
- data/vendor/behave/issue.features/issue0072.feature +32 -0
- data/vendor/behave/issue.features/issue0073.feature +228 -0
- data/vendor/behave/issue.features/issue0075.feature +18 -0
- data/vendor/behave/issue.features/issue0077.feature +89 -0
- data/vendor/behave/issue.features/issue0080.feature +49 -0
- data/vendor/behave/issue.features/issue0081.feature +138 -0
- data/vendor/behave/issue.features/issue0083.feature +69 -0
- data/vendor/behave/issue.features/issue0084.feature +69 -0
- data/vendor/behave/issue.features/issue0085.feature +119 -0
- data/vendor/behave/issue.features/issue0092.feature +66 -0
- data/vendor/behave/issue.features/issue0096.feature +173 -0
- data/vendor/behave/issue.features/issue0099.feature +130 -0
- data/vendor/behave/issue.features/issue0109.feature +60 -0
- data/vendor/behave/issue.features/issue0111.feature +53 -0
- data/vendor/behave/issue.features/issue0112.feature +64 -0
- data/vendor/behave/issue.features/issue0114.feature +118 -0
- data/vendor/behave/issue.features/issue0116.feature +71 -0
- data/vendor/behave/issue.features/issue0125.feature +49 -0
- data/vendor/behave/issue.features/issue0127.feature +64 -0
- data/vendor/behave/issue.features/issue0139.feature +67 -0
- data/vendor/behave/issue.features/issue0142.feature +37 -0
- data/vendor/behave/issue.features/issue0143.feature +54 -0
- data/vendor/behave/issue.features/issue0145.feature +63 -0
- data/vendor/behave/issue.features/issue0148.feature +105 -0
- data/vendor/behave/issue.features/issue0152.feature +52 -0
- data/vendor/behave/issue.features/issue0159.feature +74 -0
- data/vendor/behave/issue.features/issue0162.feature +86 -0
- data/vendor/behave/issue.features/issue0171.feature +16 -0
- data/vendor/behave/issue.features/issue0172.feature +51 -0
- data/vendor/behave/issue.features/issue0175.feature +91 -0
- data/vendor/behave/issue.features/issue0177.feature +40 -0
- data/vendor/behave/issue.features/issue0181.feature +36 -0
- data/vendor/behave/issue.features/issue0184.feature +144 -0
- data/vendor/behave/issue.features/issue0186.feature +12 -0
- data/vendor/behave/issue.features/issue0188.feature +60 -0
- data/vendor/behave/issue.features/issue0191.feature +178 -0
- data/vendor/behave/issue.features/issue0194.feature +215 -0
- data/vendor/behave/issue.features/issue0197.feature +11 -0
- data/vendor/behave/issue.features/issue0216.feature +129 -0
- data/vendor/behave/issue.features/issue0226.feature +51 -0
- data/vendor/behave/issue.features/issue0228.feature +41 -0
- data/vendor/behave/issue.features/issue0230.feature +46 -0
- data/vendor/behave/issue.features/issue0231.feature +77 -0
- data/vendor/behave/issue.features/issue0238.feature +52 -0
- data/vendor/behave/issue.features/issue0251.feature +15 -0
- data/vendor/behave/issue.features/issue0280.feature +118 -0
- data/vendor/behave/issue.features/issue0288.feature +95 -0
- data/vendor/behave/issue.features/issue0300.feature +49 -0
- data/vendor/behave/issue.features/issue0302.feature +91 -0
- data/vendor/behave/issue.features/issue0309.feature +52 -0
- data/vendor/behave/issue.features/issue0330.feature +124 -0
- data/vendor/behave/issue.features/issue0349.feature +9 -0
- data/vendor/behave/issue.features/issue0361.feature +79 -0
- data/vendor/behave/issue.features/issue0383.feature +76 -0
- data/vendor/behave/issue.features/issue0384.feature +103 -0
- data/vendor/behave/issue.features/issue0385.feature +109 -0
- data/vendor/behave/issue.features/issue0424.feature +66 -0
- data/vendor/behave/issue.features/issue0446.feature +116 -0
- data/vendor/behave/issue.features/issue0449.feature +42 -0
- data/vendor/behave/issue.features/issue0453.feature +42 -0
- data/vendor/behave/issue.features/issue0457.feature +65 -0
- data/vendor/behave/issue.features/issue0462.feature +38 -0
- data/vendor/behave/issue.features/issue0476.feature +39 -0
- data/vendor/behave/issue.features/issue0487.feature +92 -0
- data/vendor/behave/issue.features/issue0506.feature +77 -0
- data/vendor/behave/issue.features/issue0510.feature +51 -0
- data/vendor/behave/issue.features/requirements.txt +12 -0
- data/vendor/behave/issue.features/steps/ansi_steps.py +20 -0
- data/vendor/behave/issue.features/steps/behave_hooks_steps.py +10 -0
- data/vendor/behave/issue.features/steps/use_steplib_behave4cmd.py +13 -0
- data/vendor/behave/more.features/formatter.json.validate_output.feature +37 -0
- data/vendor/behave/more.features/steps/tutorial_steps.py +16 -0
- data/vendor/behave/more.features/steps/use_steplib_behave4cmd.py +7 -0
- data/vendor/behave/more.features/tutorial.feature +6 -0
- data/vendor/behave/py.requirements/README.txt +5 -0
- data/vendor/behave/py.requirements/all.txt +16 -0
- data/vendor/behave/py.requirements/basic.txt +21 -0
- data/vendor/behave/py.requirements/develop.txt +28 -0
- data/vendor/behave/py.requirements/docs.txt +6 -0
- data/vendor/behave/py.requirements/json.txt +7 -0
- data/vendor/behave/py.requirements/more_py26.txt +8 -0
- data/vendor/behave/py.requirements/testing.txt +10 -0
- data/vendor/behave/pytest.ini +24 -0
- data/vendor/behave/setup.cfg +29 -0
- data/vendor/behave/setup.py +118 -0
- data/vendor/behave/setuptools_behave.py +130 -0
- data/vendor/behave/tasks/__behave.py +45 -0
- data/vendor/behave/tasks/__init__.py +55 -0
- data/vendor/behave/tasks/__main__.py +70 -0
- data/vendor/behave/tasks/_setup.py +135 -0
- data/vendor/behave/tasks/_vendor/README.rst +35 -0
- data/vendor/behave/tasks/_vendor/invoke.zip +0 -0
- data/vendor/behave/tasks/_vendor/path.py +1725 -0
- data/vendor/behave/tasks/_vendor/pathlib.py +1280 -0
- data/vendor/behave/tasks/_vendor/six.py +868 -0
- data/vendor/behave/tasks/clean.py +246 -0
- data/vendor/behave/tasks/docs.py +97 -0
- data/vendor/behave/tasks/requirements.txt +17 -0
- data/vendor/behave/tasks/test.py +192 -0
- data/vendor/behave/test/__init__.py +0 -0
- data/vendor/behave/test/_importer_candidate.py +3 -0
- data/vendor/behave/test/reporters/__init__.py +0 -0
- data/vendor/behave/test/reporters/test_summary.py +240 -0
- data/vendor/behave/test/test_ansi_escapes.py +73 -0
- data/vendor/behave/test/test_configuration.py +172 -0
- data/vendor/behave/test/test_formatter.py +265 -0
- data/vendor/behave/test/test_formatter_progress.py +39 -0
- data/vendor/behave/test/test_formatter_rerun.py +97 -0
- data/vendor/behave/test/test_formatter_tags.py +57 -0
- data/vendor/behave/test/test_importer.py +151 -0
- data/vendor/behave/test/test_log_capture.py +29 -0
- data/vendor/behave/test/test_matchers.py +236 -0
- data/vendor/behave/test/test_model.py +871 -0
- data/vendor/behave/test/test_parser.py +1590 -0
- data/vendor/behave/test/test_runner.py +1074 -0
- data/vendor/behave/test/test_step_registry.py +96 -0
- data/vendor/behave/test/test_tag_expression.py +506 -0
- data/vendor/behave/test/test_tag_expression2.py +462 -0
- data/vendor/behave/test/test_tag_matcher.py +729 -0
- data/vendor/behave/test/test_userdata.py +184 -0
- data/vendor/behave/tests/README.txt +12 -0
- data/vendor/behave/tests/__init__.py +0 -0
- data/vendor/behave/tests/api/__ONLY_PY34_or_newer.txt +0 -0
- data/vendor/behave/tests/api/__init__.py +0 -0
- data/vendor/behave/tests/api/_test_async_step34.py +130 -0
- data/vendor/behave/tests/api/_test_async_step35.py +75 -0
- data/vendor/behave/tests/api/test_async_step.py +18 -0
- data/vendor/behave/tests/api/testing_support.py +94 -0
- data/vendor/behave/tests/api/testing_support_async.py +21 -0
- data/vendor/behave/tests/issues/test_issue0336.py +66 -0
- data/vendor/behave/tests/issues/test_issue0449.py +55 -0
- data/vendor/behave/tests/issues/test_issue0453.py +62 -0
- data/vendor/behave/tests/issues/test_issue0458.py +54 -0
- data/vendor/behave/tests/issues/test_issue0495.py +65 -0
- data/vendor/behave/tests/unit/__init__.py +0 -0
- data/vendor/behave/tests/unit/test_behave4cmd_command_shell_proc.py +135 -0
- data/vendor/behave/tests/unit/test_capture.py +280 -0
- data/vendor/behave/tests/unit/test_model_core.py +56 -0
- data/vendor/behave/tests/unit/test_textutil.py +267 -0
- data/vendor/behave/tools/test-features/background.feature +9 -0
- data/vendor/behave/tools/test-features/environment.py +8 -0
- data/vendor/behave/tools/test-features/french.feature +11 -0
- data/vendor/behave/tools/test-features/outline.feature +39 -0
- data/vendor/behave/tools/test-features/parse.feature +10 -0
- data/vendor/behave/tools/test-features/step-data.feature +60 -0
- data/vendor/behave/tools/test-features/steps/steps.py +120 -0
- data/vendor/behave/tools/test-features/tags.feature +18 -0
- data/vendor/behave/tox.ini +159 -0
- metadata +562 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Step definition for Context object tests.
|
|
4
|
+
|
|
5
|
+
EXAMPLE
|
|
6
|
+
Scenario: Show that Context parameter
|
|
7
|
+
Given I set the parameter "person" to "Alice" in the behave context
|
|
8
|
+
Then the behave context should have a parameter named "person"
|
|
9
|
+
And the behave context object should contain:
|
|
10
|
+
| Parameter | Value |
|
|
11
|
+
| person | "Alice" |
|
|
12
|
+
|
|
13
|
+
Scenario: Show that Context parameter are not present in next scenario
|
|
14
|
+
Then the behave context should not have a parameter named "person"
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import absolute_import
|
|
18
|
+
from behave import given, then, step
|
|
19
|
+
from hamcrest import assert_that, equal_to
|
|
20
|
+
import six
|
|
21
|
+
|
|
22
|
+
# -----------------------------------------------------------------------------
|
|
23
|
+
# STEPS:
|
|
24
|
+
# -----------------------------------------------------------------------------
|
|
25
|
+
@step(u'I set the context parameter "{param_name}" to "{value}"')
|
|
26
|
+
def step_set_behave_context_parameter_to(context, param_name, value):
|
|
27
|
+
setattr(context, param_name, value)
|
|
28
|
+
|
|
29
|
+
@step(u'the parameter "{param_name}" exists in the behave context')
|
|
30
|
+
def step_behave_context_parameter_exists(context, param_name):
|
|
31
|
+
assert hasattr(context, param_name)
|
|
32
|
+
|
|
33
|
+
@step(u'the parameter "{param_name}" does not exist in the behave context')
|
|
34
|
+
def step_behave_context_parameter_not_exists(context, param_name):
|
|
35
|
+
assert not hasattr(context, param_name)
|
|
36
|
+
|
|
37
|
+
@given(u'the behave context has a parameter "{param_name}"')
|
|
38
|
+
def given_behave_context_has_parameter_named(context, param_name):
|
|
39
|
+
step_behave_context_parameter_exists(context, param_name)
|
|
40
|
+
|
|
41
|
+
@given(u'the behave context does not have a parameter "{param_name}"')
|
|
42
|
+
def given_behave_context_does_not_have_parameter_named(context, param_name):
|
|
43
|
+
step_behave_context_parameter_not_exists(context, param_name)
|
|
44
|
+
|
|
45
|
+
@step(u'the behave context should have a parameter "{param_name}"')
|
|
46
|
+
def step_behave_context_should_have_parameter_named(context, param_name):
|
|
47
|
+
step_behave_context_parameter_exists(context, param_name)
|
|
48
|
+
|
|
49
|
+
@step(u'the behave context should not have a parameter "{param_name}"')
|
|
50
|
+
def step_behave_context_should_not_have_parameter_named(context, param_name):
|
|
51
|
+
step_behave_context_parameter_not_exists(context, param_name)
|
|
52
|
+
|
|
53
|
+
@then(u'the behave context should contain')
|
|
54
|
+
def then_behave_context_should_contain_with_table(context):
|
|
55
|
+
assert context.table, "ENSURE: table is provided."
|
|
56
|
+
for row in context.table.rows:
|
|
57
|
+
param_name = row["Parameter"]
|
|
58
|
+
param_value = row["Value"]
|
|
59
|
+
if param_value.startswith('"') and param_value.endswith('"'):
|
|
60
|
+
param_value = param_value[1:-1]
|
|
61
|
+
actual = six.text_type(getattr(context, param_name, None))
|
|
62
|
+
assert hasattr(context, param_name)
|
|
63
|
+
assert_that(actual, equal_to(param_value))
|
|
64
|
+
|
|
65
|
+
@given(u'the behave context contains')
|
|
66
|
+
def given_behave_context_contains_with_table(context):
|
|
67
|
+
then_behave_context_should_contain_with_table(context)
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Provides step definitions that test tag logic for selected features, scenarios.
|
|
4
|
+
|
|
5
|
+
.. code-block:: Gherkin
|
|
6
|
+
|
|
7
|
+
# -- Scenario: Select scenarios with tags
|
|
8
|
+
Given I use the behave model builder with:
|
|
9
|
+
| statement | name | tags | Comment |
|
|
10
|
+
| Scenario | A1 | @foo | |
|
|
11
|
+
| Scenario | A3 | @foo @bar | |
|
|
12
|
+
| Scenario | B3 | | Untagged |
|
|
13
|
+
When I run the behave with tags
|
|
14
|
+
Then the following scenarios are selected with cmdline:
|
|
15
|
+
| cmdline | selected | Logic comment |
|
|
16
|
+
| --tags=@foo | A1, A3, B2 | @foo |
|
|
17
|
+
| --tags=-@foo | A1, A3, B2 | @foo |
|
|
18
|
+
|
|
19
|
+
.. code-block:: Gherkin
|
|
20
|
+
|
|
21
|
+
# IDEA:
|
|
22
|
+
# -- Scenario: Select scenarios with tags
|
|
23
|
+
Given I use the behave model builder with:
|
|
24
|
+
| statement | name | tags | Comment |
|
|
25
|
+
| Feature | Alice | @alice | |
|
|
26
|
+
| Scenario | A1 | @foo | |
|
|
27
|
+
| Scenario | A2 | @bar | |
|
|
28
|
+
| Scenario | A3 | @foo @bar | |
|
|
29
|
+
| Feature | Bob | @bob | |
|
|
30
|
+
| Scenario | B1 | @bar | |
|
|
31
|
+
| Scenario | B2 | @foo | |
|
|
32
|
+
| Scenario | B3 | | Untagged |
|
|
33
|
+
When I run the behave with options "--tags=@foo"
|
|
34
|
+
Then the following scenarios are selected:
|
|
35
|
+
| statement | name | selected |
|
|
36
|
+
| Scenario | A1 | yes |
|
|
37
|
+
| Scenario | A2 | no |
|
|
38
|
+
| Scenario | A3 | yes |
|
|
39
|
+
| Scenario | B1 | no |
|
|
40
|
+
| Scenario | B2 | yes |
|
|
41
|
+
| Scenario | B3 | no |
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
from __future__ import absolute_import
|
|
45
|
+
from behave import given, when, then
|
|
46
|
+
from behave_model_util import BehaveModelBuilder, convert_comma_list
|
|
47
|
+
from behave_model_util import \
|
|
48
|
+
run_model_with_cmdline, collect_selected_and_skipped_scenarios
|
|
49
|
+
from hamcrest import assert_that, equal_to
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# -----------------------------------------------------------------------------
|
|
53
|
+
# STEP DEFINITIONS:
|
|
54
|
+
# -----------------------------------------------------------------------------
|
|
55
|
+
@given('a behave model with')
|
|
56
|
+
def step_given_a_behave_model_with_table(context):
|
|
57
|
+
"""
|
|
58
|
+
Build a behave feature model from a tabular description.
|
|
59
|
+
|
|
60
|
+
.. code-block:: gherkin
|
|
61
|
+
|
|
62
|
+
# -- Scenario: Select scenarios with tags
|
|
63
|
+
Given I use the behave model builder with:
|
|
64
|
+
| statement | name | tags | Comment |
|
|
65
|
+
| Scenario | S0 | | Untagged |
|
|
66
|
+
| Scenario | S1 | @foo | |
|
|
67
|
+
| Scenario | S3 | @foo @bar | |
|
|
68
|
+
"""
|
|
69
|
+
assert context.table, "REQUIRE: context.table"
|
|
70
|
+
context.table.require_columns(BehaveModelBuilder.REQUIRED_COLUMNS)
|
|
71
|
+
model_builder = BehaveModelBuilder()
|
|
72
|
+
context.behave_model = model_builder.build_model_from_table(context.table)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@when('I run the behave model with "{hint}"')
|
|
76
|
+
def step_when_run_behave_model_with_hint(context, hint):
|
|
77
|
+
pass # -- ONLY: SYNTACTIC SUGAR
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@then('the following scenarios are selected with cmdline')
|
|
81
|
+
def step_then_scenarios_are_selected_with_cmdline(context):
|
|
82
|
+
"""
|
|
83
|
+
.. code-block:: Gherkin
|
|
84
|
+
|
|
85
|
+
Then the following scenarios are selected with cmdline:
|
|
86
|
+
| cmdline | selected? | Logic comment |
|
|
87
|
+
| --tags=@foo | A1, A3, B2 | @foo |
|
|
88
|
+
"""
|
|
89
|
+
assert context.behave_model, "REQUIRE: context attribute"
|
|
90
|
+
assert context.table, "REQUIRE: context.table"
|
|
91
|
+
context.table.require_columns(["cmdline", "selected?"])
|
|
92
|
+
|
|
93
|
+
model = context.behave_model
|
|
94
|
+
for row_index, row in enumerate(context.table.rows):
|
|
95
|
+
cmdline = row["cmdline"]
|
|
96
|
+
expected_selected_names = convert_comma_list(row["selected?"])
|
|
97
|
+
|
|
98
|
+
# -- STEP: Run model with cmdline tags
|
|
99
|
+
run_model_with_cmdline(model, cmdline)
|
|
100
|
+
selected, skipped = collect_selected_and_skipped_scenarios(model)
|
|
101
|
+
actual_selected = [scenario.name for scenario in selected]
|
|
102
|
+
|
|
103
|
+
# -- CHECK:
|
|
104
|
+
assert_that(actual_selected, equal_to(expected_selected_names),
|
|
105
|
+
"cmdline=%s (row=%s)" % (cmdline, row_index))
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
|
2
|
+
|
|
3
|
+
from __future__ import absolute_import
|
|
4
|
+
from behave.model import Feature, Scenario, reset_model
|
|
5
|
+
from behave.model_core import Status
|
|
6
|
+
from behave.runner import ModelRunner
|
|
7
|
+
from behave.parser import parse_tags
|
|
8
|
+
from behave.configuration import Configuration
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# -----------------------------------------------------------------------------
|
|
12
|
+
# TYPE CONVERTERS:
|
|
13
|
+
# -----------------------------------------------------------------------------
|
|
14
|
+
def convert_comma_list(text):
|
|
15
|
+
text = text.strip()
|
|
16
|
+
return [part.strip() for part in text.split(",")]
|
|
17
|
+
|
|
18
|
+
def convert_model_element_tags(text):
|
|
19
|
+
return parse_tags(text.strip())
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# -----------------------------------------------------------------------------
|
|
23
|
+
# TEST DOMAIN, FIXTURES, STEP UTILS:
|
|
24
|
+
# -----------------------------------------------------------------------------
|
|
25
|
+
class Model(object):
|
|
26
|
+
def __init__(self, features=None):
|
|
27
|
+
self.features = features or []
|
|
28
|
+
|
|
29
|
+
class BehaveModelBuilder(object):
|
|
30
|
+
REQUIRED_COLUMNS = ["statement", "name"]
|
|
31
|
+
OPTIONAL_COLUMNS = ["tags"]
|
|
32
|
+
|
|
33
|
+
def __init__(self):
|
|
34
|
+
self.features = []
|
|
35
|
+
self.current_feature = None
|
|
36
|
+
self.current_scenario = None
|
|
37
|
+
|
|
38
|
+
def build_feature(self, name=u"", tags=None):
|
|
39
|
+
if not name:
|
|
40
|
+
name = u"alice"
|
|
41
|
+
filename = u"%s.feature" % name
|
|
42
|
+
line = 1
|
|
43
|
+
feature = Feature(filename, line, u"Feature", name, tags=tags)
|
|
44
|
+
self.features.append(feature)
|
|
45
|
+
self.current_feature = feature
|
|
46
|
+
return feature
|
|
47
|
+
|
|
48
|
+
def build_scenario(self, name="", tags=None):
|
|
49
|
+
if not self.current_feature:
|
|
50
|
+
self.build_feature()
|
|
51
|
+
filename = self.current_feature.filename
|
|
52
|
+
line = self.current_feature.line + 1
|
|
53
|
+
scenario = Scenario(filename, line, u"Scenario", name, tags=tags)
|
|
54
|
+
self.current_feature.add_scenario(scenario)
|
|
55
|
+
self.current_scenario = scenario
|
|
56
|
+
return scenario
|
|
57
|
+
|
|
58
|
+
def build_unknown(self, statement, name=u"", row_index=None):
|
|
59
|
+
# pylint: disable=no-self-use
|
|
60
|
+
assert False, u"UNSUPPORTED: statement=%s, name=%s (row=%s)" % \
|
|
61
|
+
(statement, name, row_index)
|
|
62
|
+
|
|
63
|
+
def build_model_from_table(self, table):
|
|
64
|
+
table.require_columns(self.REQUIRED_COLUMNS)
|
|
65
|
+
for row_index, row in enumerate(table.rows):
|
|
66
|
+
statement = row["statement"]
|
|
67
|
+
name = row["name"]
|
|
68
|
+
tags = row.get("tags", [])
|
|
69
|
+
if tags:
|
|
70
|
+
tags = convert_model_element_tags(tags)
|
|
71
|
+
|
|
72
|
+
if statement == "Feature":
|
|
73
|
+
self.build_feature(name, tags)
|
|
74
|
+
elif statement == "Scenario":
|
|
75
|
+
self.build_scenario(name, tags)
|
|
76
|
+
else:
|
|
77
|
+
self.build_unknown(statement, name, row_index=row_index)
|
|
78
|
+
return Model(self.features)
|
|
79
|
+
|
|
80
|
+
def run_model_with_cmdline(model, cmdline):
|
|
81
|
+
reset_model(model.features)
|
|
82
|
+
command_args = cmdline
|
|
83
|
+
config = Configuration(command_args,
|
|
84
|
+
load_config=False,
|
|
85
|
+
default_format="null",
|
|
86
|
+
stdout_capture=False,
|
|
87
|
+
stderr_capture=False,
|
|
88
|
+
log_capture=False)
|
|
89
|
+
model_runner = ModelRunner(config, model.features)
|
|
90
|
+
return model_runner.run()
|
|
91
|
+
|
|
92
|
+
def collect_selected_and_skipped_scenarios(model): # pylint: disable=invalid-name
|
|
93
|
+
selected = []
|
|
94
|
+
skipped = []
|
|
95
|
+
for feature in model.features:
|
|
96
|
+
scenarios = feature.scenarios
|
|
97
|
+
for scenario in scenarios:
|
|
98
|
+
if scenario.status == Status.skipped:
|
|
99
|
+
skipped.append(scenario)
|
|
100
|
+
else:
|
|
101
|
+
assert scenario.status != Status.untested
|
|
102
|
+
selected.append(scenario)
|
|
103
|
+
return (selected, skipped)
|
|
104
|
+
|
|
105
|
+
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Provides step definitions that test how the behave runner selects feature files.
|
|
4
|
+
|
|
5
|
+
EXAMPLE:
|
|
6
|
+
Given behave has the following feature fileset:
|
|
7
|
+
'''
|
|
8
|
+
features/alice.feature
|
|
9
|
+
features/bob.feature
|
|
10
|
+
features/barbi.feature
|
|
11
|
+
'''
|
|
12
|
+
When behave includes feature files with "features/a.*\.feature"
|
|
13
|
+
And behave excludes feature files with "features/b.*\.feature"
|
|
14
|
+
Then the following feature files are selected:
|
|
15
|
+
'''
|
|
16
|
+
features/alice.feature
|
|
17
|
+
'''
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from __future__ import absolute_import
|
|
21
|
+
from behave import given, when, then
|
|
22
|
+
from behave.runner_util import FeatureListParser
|
|
23
|
+
from hamcrest import assert_that, equal_to
|
|
24
|
+
from copy import copy
|
|
25
|
+
import re
|
|
26
|
+
import six
|
|
27
|
+
|
|
28
|
+
# -----------------------------------------------------------------------------
|
|
29
|
+
# STEP UTILS:
|
|
30
|
+
# -----------------------------------------------------------------------------
|
|
31
|
+
class BasicBehaveRunner(object):
|
|
32
|
+
def __init__(self, config=None):
|
|
33
|
+
self.config = config
|
|
34
|
+
self.feature_files = []
|
|
35
|
+
|
|
36
|
+
def select_files(self):
|
|
37
|
+
"""
|
|
38
|
+
Emulate behave runners file selection by using include/exclude patterns.
|
|
39
|
+
:return: List of selected feature filenames.
|
|
40
|
+
"""
|
|
41
|
+
selected = []
|
|
42
|
+
for filename in self.feature_files:
|
|
43
|
+
if not self.config.exclude(filename):
|
|
44
|
+
selected.append(six.text_type(filename))
|
|
45
|
+
return selected
|
|
46
|
+
|
|
47
|
+
# -----------------------------------------------------------------------------
|
|
48
|
+
# STEP DEFINITIONS:
|
|
49
|
+
# -----------------------------------------------------------------------------
|
|
50
|
+
@given('behave has the following feature fileset')
|
|
51
|
+
def step_given_behave_has_feature_fileset(context):
|
|
52
|
+
assert context.text is not None, "REQUIRE: text"
|
|
53
|
+
behave_runner = BasicBehaveRunner(config=copy(context.config))
|
|
54
|
+
behave_runner.feature_files = FeatureListParser.parse(context.text)
|
|
55
|
+
context.behave_runner = behave_runner
|
|
56
|
+
|
|
57
|
+
@when('behave includes all feature files')
|
|
58
|
+
def step_when_behave_includes_all_feature_files(context):
|
|
59
|
+
assert context.behave_runner, "REQUIRE: context.behave_runner"
|
|
60
|
+
context.behave_runner.config.include_re = None
|
|
61
|
+
|
|
62
|
+
@when('behave includes feature files with "{pattern}"')
|
|
63
|
+
def step_when_behave_includes_feature_files_with_pattern(context, pattern):
|
|
64
|
+
assert context.behave_runner, "REQUIRE: context.behave_runner"
|
|
65
|
+
context.behave_runner.config.include_re = re.compile(pattern)
|
|
66
|
+
|
|
67
|
+
@when('behave excludes no feature files')
|
|
68
|
+
def step_when_behave_excludes_no_feature_files(context):
|
|
69
|
+
assert context.behave_runner, "REQUIRE: context.behave_runner"
|
|
70
|
+
context.behave_runner.config.exclude_re = None
|
|
71
|
+
|
|
72
|
+
@when('behave excludes feature files with "{pattern}"')
|
|
73
|
+
def step_when_behave_excludes_feature_files_with_pattern(context, pattern):
|
|
74
|
+
assert context.behave_runner, "REQUIRE: context.behave_runner"
|
|
75
|
+
context.behave_runner.config.exclude_re = re.compile(pattern)
|
|
76
|
+
|
|
77
|
+
@then('the following feature files are selected')
|
|
78
|
+
def step_then_feature_files_are_selected_with_text(context):
|
|
79
|
+
assert context.text is not None, "REQUIRE: text"
|
|
80
|
+
assert context.behave_runner, "REQUIRE: context.behave_runner"
|
|
81
|
+
selected_files = context.text.strip().splitlines()
|
|
82
|
+
actual_files = context.behave_runner.select_files()
|
|
83
|
+
assert_that(actual_files, equal_to(selected_files))
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Provides step definitions that test tag expressions (and tag logic).
|
|
4
|
+
|
|
5
|
+
.. code-block:: gherkin
|
|
6
|
+
|
|
7
|
+
Given the default tags "-@foo"
|
|
8
|
+
And the tag expression "@foo"
|
|
9
|
+
Then the tag expression selects elements with tags:
|
|
10
|
+
| tags | selected? |
|
|
11
|
+
| @foo | yes |
|
|
12
|
+
| @other | no |
|
|
13
|
+
|
|
14
|
+
.. code-block:: gherkin
|
|
15
|
+
|
|
16
|
+
Given the named model elements with tags:
|
|
17
|
+
| name | tags |
|
|
18
|
+
| S1 | @foo |
|
|
19
|
+
Then the tag expression select model elements with:
|
|
20
|
+
| tag expression | selected? |
|
|
21
|
+
| @foo | S1, S3 |
|
|
22
|
+
| -@foo | S0, S2, S3 |
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
from __future__ import absolute_import
|
|
26
|
+
from behave import given, then, register_type
|
|
27
|
+
from behave.tag_expression import TagExpression
|
|
28
|
+
from behave_model_util import convert_comma_list, convert_model_element_tags
|
|
29
|
+
from hamcrest import assert_that, equal_to
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# -----------------------------------------------------------------------------
|
|
33
|
+
# TEST DOMAIN, FIXTURES, STEP UTILS:
|
|
34
|
+
# -----------------------------------------------------------------------------
|
|
35
|
+
class ModelElement(object):
|
|
36
|
+
def __init__(self, name, tags=None):
|
|
37
|
+
self.name = name
|
|
38
|
+
self.tags = tags or []
|
|
39
|
+
|
|
40
|
+
# -----------------------------------------------------------------------------
|
|
41
|
+
# TYPE CONVERTERS:
|
|
42
|
+
# -----------------------------------------------------------------------------
|
|
43
|
+
def convert_tag_expression(text):
|
|
44
|
+
parts = text.strip().split()
|
|
45
|
+
return TagExpression(parts)
|
|
46
|
+
register_type(TagExpression=convert_tag_expression)
|
|
47
|
+
|
|
48
|
+
def convert_yesno(text):
|
|
49
|
+
text = text.strip().lower()
|
|
50
|
+
assert text in convert_yesno.choices
|
|
51
|
+
return text in convert_yesno.true_choices
|
|
52
|
+
convert_yesno.choices = ("yes", "no", "true", "false")
|
|
53
|
+
convert_yesno.true_choices = ("yes", "true")
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# -----------------------------------------------------------------------------
|
|
57
|
+
# STEP DEFINITIONS:
|
|
58
|
+
# -----------------------------------------------------------------------------
|
|
59
|
+
@given('the tag expression "{tag_expression:TagExpression}"')
|
|
60
|
+
def step_given_the_tag_expression(context, tag_expression):
|
|
61
|
+
"""
|
|
62
|
+
Define a tag expression that is used later-on.
|
|
63
|
+
|
|
64
|
+
.. code-block:: gherkin
|
|
65
|
+
|
|
66
|
+
Given the tag expression "@foo"
|
|
67
|
+
"""
|
|
68
|
+
context.tag_expression = tag_expression
|
|
69
|
+
|
|
70
|
+
@given('the default tags "{default_tags:TagExpression}"')
|
|
71
|
+
def step_given_the_tag_expression(context, default_tags):
|
|
72
|
+
"""
|
|
73
|
+
Define a tag expression that is used later-on.
|
|
74
|
+
|
|
75
|
+
.. code-block:: gherkin
|
|
76
|
+
|
|
77
|
+
Given the tag expression "@foo"
|
|
78
|
+
"""
|
|
79
|
+
context.default_tags = default_tags
|
|
80
|
+
tag_expression = getattr(context, "tag_expression", None)
|
|
81
|
+
if tag_expression is None:
|
|
82
|
+
context.tag_expression = default_tags
|
|
83
|
+
|
|
84
|
+
@then('the tag expression selects elements with tags')
|
|
85
|
+
def step_then_tag_expression_selects_elements_with_tags(context):
|
|
86
|
+
"""
|
|
87
|
+
Checks if a tag expression selects an element with the given tags.
|
|
88
|
+
|
|
89
|
+
.. code-block:: gherkin
|
|
90
|
+
Then the tag expression selects elements with tags:
|
|
91
|
+
| tags | selected? |
|
|
92
|
+
| @foo | yes |
|
|
93
|
+
| @other | no |
|
|
94
|
+
"""
|
|
95
|
+
assert context.tag_expression, "REQUIRE: context.tag_expression"
|
|
96
|
+
context.table.require_columns(["tags", "selected?"])
|
|
97
|
+
tag_expression = context.tag_expression
|
|
98
|
+
expected = []
|
|
99
|
+
actual = []
|
|
100
|
+
for row in context.table.rows:
|
|
101
|
+
element_tags = convert_model_element_tags(row["tags"])
|
|
102
|
+
expected_element_selected = convert_yesno(row["selected?"])
|
|
103
|
+
actual_element_selected = tag_expression.check(element_tags)
|
|
104
|
+
expected.append((element_tags, expected_element_selected))
|
|
105
|
+
actual.append((element_tags, actual_element_selected))
|
|
106
|
+
|
|
107
|
+
# -- PERFORM CHECK:
|
|
108
|
+
assert_that(actual, equal_to(expected))
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
@given('the model elements with name and tags')
|
|
112
|
+
def step_given_named_model_elements_with_tags(context):
|
|
113
|
+
"""
|
|
114
|
+
.. code-block:: gherkin
|
|
115
|
+
|
|
116
|
+
Given the model elements with name and tags:
|
|
117
|
+
| name | tags |
|
|
118
|
+
| S1 | @foo |
|
|
119
|
+
Then the tag expression select model elements with:
|
|
120
|
+
| tag expression | selected? |
|
|
121
|
+
| @foo | S1, S3 |
|
|
122
|
+
| -@foo | S0, S2, S3 |
|
|
123
|
+
"""
|
|
124
|
+
assert context.table, "REQUIRE: context.table"
|
|
125
|
+
context.table.require_columns(["name", "tags"])
|
|
126
|
+
|
|
127
|
+
# -- PREPARE:
|
|
128
|
+
model_element_names = set()
|
|
129
|
+
model_elements = []
|
|
130
|
+
for row in context.table.rows:
|
|
131
|
+
name = row["name"].strip()
|
|
132
|
+
tags = convert_model_element_tags(row["tags"])
|
|
133
|
+
assert name not in model_element_names, "DUPLICATED: name=%s" % name
|
|
134
|
+
model_elements.append(ModelElement(name, tags=tags))
|
|
135
|
+
model_element_names.add(name)
|
|
136
|
+
|
|
137
|
+
# -- SETUP:
|
|
138
|
+
context.model_elements = model_elements
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
@then('the tag expression selects model elements with')
|
|
142
|
+
def step_given_named_model_elements_with_tags(context):
|
|
143
|
+
"""
|
|
144
|
+
.. code-block:: gherkin
|
|
145
|
+
|
|
146
|
+
Then the tag expression select model elements with:
|
|
147
|
+
| tag expression | selected? |
|
|
148
|
+
| @foo | S1, S3 |
|
|
149
|
+
| -@foo | S0, S2, S3 |
|
|
150
|
+
"""
|
|
151
|
+
assert context.model_elements, "REQUIRE: context attribute"
|
|
152
|
+
assert context.table, "REQUIRE: context.table"
|
|
153
|
+
context.table.require_columns(["tag expression", "selected?"])
|
|
154
|
+
|
|
155
|
+
for row_index, row in enumerate(context.table.rows):
|
|
156
|
+
tag_expression_text = row["tag expression"]
|
|
157
|
+
tag_expression = convert_tag_expression(tag_expression_text)
|
|
158
|
+
expected_selected_names = convert_comma_list(row["selected?"])
|
|
159
|
+
|
|
160
|
+
actual_selected = []
|
|
161
|
+
for model_element in context.model_elements:
|
|
162
|
+
if tag_expression.check(model_element.tags):
|
|
163
|
+
actual_selected.append(model_element.name)
|
|
164
|
+
|
|
165
|
+
assert_that(actual_selected, equal_to(expected_selected_names),
|
|
166
|
+
"tag_expression=%s (row=%s)" % (tag_expression_text, row_index))
|