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,246 @@
|
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Provides cleanup tasks for invoke build scripts.
|
|
4
|
+
|
|
5
|
+
clean task: Add Additional Directories and Files to be removed
|
|
6
|
+
-------------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
Create an invoke configuration file (YAML of JSON) with the additional
|
|
9
|
+
configuration data:
|
|
10
|
+
|
|
11
|
+
.. code-block:: yaml
|
|
12
|
+
|
|
13
|
+
# -- FILE: invoke.yaml
|
|
14
|
+
# USE: clean.directories, clean.files to override current configuration.
|
|
15
|
+
clean:
|
|
16
|
+
extra_directories:
|
|
17
|
+
- **/tmp/
|
|
18
|
+
extra_files:
|
|
19
|
+
- **/*.log
|
|
20
|
+
- **/*.bak
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
Registration of Cleanup Tasks
|
|
24
|
+
------------------------------
|
|
25
|
+
|
|
26
|
+
Other task modules often have an own cleanup task to recover the clean state.
|
|
27
|
+
The :meth:`clean` task, that is provided here, supports the registration
|
|
28
|
+
of additional cleanup tasks. Therefore, when the :meth:`clean` task is executed,
|
|
29
|
+
all registered cleanup tasks will be executed.
|
|
30
|
+
|
|
31
|
+
EXAMPLE::
|
|
32
|
+
|
|
33
|
+
# -- FILE: tasks/docs.py
|
|
34
|
+
from __future__ import absolute_import
|
|
35
|
+
from invoke import task, Collection
|
|
36
|
+
from .clean import cleanup_tasks, cleanup_dirs
|
|
37
|
+
|
|
38
|
+
@task
|
|
39
|
+
def clean(ctx, dry_run=False):
|
|
40
|
+
"Cleanup generated documentation artifacts."
|
|
41
|
+
cleanup_dirs(["build/docs"])
|
|
42
|
+
|
|
43
|
+
namespace = Collection(clean)
|
|
44
|
+
...
|
|
45
|
+
|
|
46
|
+
# -- REGISTER CLEANUP TASK:
|
|
47
|
+
cleanup_tasks.add_task(clean, "clean_docs")
|
|
48
|
+
cleanup_tasks.configure(namespace.configuration())
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
from __future__ import absolute_import
|
|
52
|
+
from invoke import task, Collection
|
|
53
|
+
from invoke.executor import Executor
|
|
54
|
+
from invoke.exceptions import Failure
|
|
55
|
+
import os.path
|
|
56
|
+
import sys
|
|
57
|
+
from path import Path
|
|
58
|
+
import pathlib
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
# -----------------------------------------------------------------------------
|
|
62
|
+
# TASKS:
|
|
63
|
+
# -----------------------------------------------------------------------------
|
|
64
|
+
@task
|
|
65
|
+
def clean(ctx, dry_run=False):
|
|
66
|
+
"""Cleanup temporary dirs/files to regain a clean state."""
|
|
67
|
+
# -- VARIATION-POINT 1: Allow user to override in configuration-file
|
|
68
|
+
directories = ctx.clean.directories
|
|
69
|
+
files = ctx.clean.files
|
|
70
|
+
|
|
71
|
+
# -- VARIATION-POINT 2: Allow user to add more files/dirs to be removed.
|
|
72
|
+
extra_directories = ctx.clean.extra_directories or []
|
|
73
|
+
extra_files = ctx.clean.extra_files or []
|
|
74
|
+
if extra_directories:
|
|
75
|
+
directories.extend(extra_directories)
|
|
76
|
+
if extra_files:
|
|
77
|
+
files.extend(extra_files)
|
|
78
|
+
|
|
79
|
+
# -- PERFORM CLEANUP:
|
|
80
|
+
execute_cleanup_tasks(ctx, cleanup_tasks, dry_run=dry_run)
|
|
81
|
+
cleanup_dirs(directories, dry_run=dry_run)
|
|
82
|
+
cleanup_files(files, dry_run=dry_run)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@task(name="clean-all", aliases=("distclean",))
|
|
86
|
+
def clean_all(ctx, dry_run=False):
|
|
87
|
+
"""Clean up everything, even the precious stuff.
|
|
88
|
+
NOTE: clean task is executed first.
|
|
89
|
+
"""
|
|
90
|
+
cleanup_dirs(ctx.clean_all.directories or [], dry_run=dry_run)
|
|
91
|
+
cleanup_dirs(ctx.clean_all.extra_directories or [], dry_run=dry_run)
|
|
92
|
+
cleanup_files(ctx.clean_all.files or [], dry_run=dry_run)
|
|
93
|
+
cleanup_files(ctx.clean_all.extra_files or [], dry_run=dry_run)
|
|
94
|
+
execute_cleanup_tasks(ctx, cleanup_all_tasks, dry_run=dry_run)
|
|
95
|
+
clean(ctx, dry_run=dry_run)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@task
|
|
99
|
+
def clean_python(ctx, dry_run=False):
|
|
100
|
+
"""Cleanup python related files/dirs: *.pyc, *.pyo, ..."""
|
|
101
|
+
# MAYBE NOT: "**/__pycache__"
|
|
102
|
+
cleanup_dirs(["build", "dist", "*.egg-info", "**/__pycache__"],
|
|
103
|
+
dry_run=dry_run)
|
|
104
|
+
if not dry_run:
|
|
105
|
+
ctx.run("py.cleanup")
|
|
106
|
+
cleanup_files(["**/*.pyc", "**/*.pyo", "**/*$py.class"], dry_run=dry_run)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
# -----------------------------------------------------------------------------
|
|
110
|
+
# CLEANUP UTILITIES:
|
|
111
|
+
# -----------------------------------------------------------------------------
|
|
112
|
+
def execute_cleanup_tasks(ctx, cleanup_tasks, dry_run=False):
|
|
113
|
+
"""Execute several cleanup tasks as part of the cleanup.
|
|
114
|
+
|
|
115
|
+
REQUIRES: ``clean(ctx, dry_run=False)`` signature in cleanup tasks.
|
|
116
|
+
|
|
117
|
+
:param ctx: Context object for the tasks.
|
|
118
|
+
:param cleanup_tasks: Collection of cleanup tasks (as Collection).
|
|
119
|
+
:param dry_run: Indicates dry-run mode (bool)
|
|
120
|
+
"""
|
|
121
|
+
executor = Executor(cleanup_tasks, ctx.config)
|
|
122
|
+
for cleanup_task in cleanup_tasks.tasks:
|
|
123
|
+
print("CLEANUP TASK: %s" % cleanup_task)
|
|
124
|
+
executor.execute((cleanup_task, dict(dry_run=dry_run)))
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def cleanup_dirs(patterns, dry_run=False, workdir="."):
|
|
128
|
+
"""Remove directories (and their contents) recursively.
|
|
129
|
+
Skips removal if directories does not exist.
|
|
130
|
+
|
|
131
|
+
:param patterns: Directory name patterns, like "**/tmp*" (as list).
|
|
132
|
+
:param dry_run: Dry-run mode indicator (as bool).
|
|
133
|
+
:param workdir: Current work directory (default=".")
|
|
134
|
+
"""
|
|
135
|
+
current_dir = Path(workdir)
|
|
136
|
+
python_basedir = Path(Path(sys.executable).dirname()).joinpath("..").abspath()
|
|
137
|
+
warn2_counter = 0
|
|
138
|
+
for dir_pattern in patterns:
|
|
139
|
+
for directory in path_glob(dir_pattern, current_dir):
|
|
140
|
+
directory2 = directory.abspath()
|
|
141
|
+
if sys.executable.startswith(directory2):
|
|
142
|
+
print("SKIP-SUICIDE: '%s' contains current python executable" % directory)
|
|
143
|
+
continue
|
|
144
|
+
elif directory2.startswith(python_basedir):
|
|
145
|
+
# -- PROTECT CURRENTLY USED VIRTUAL ENVIRONMENT:
|
|
146
|
+
if warn2_counter <= 4:
|
|
147
|
+
print("SKIP-SUICIDE: '%s'" % directory)
|
|
148
|
+
warn2_counter += 1
|
|
149
|
+
continue
|
|
150
|
+
|
|
151
|
+
if dry_run:
|
|
152
|
+
print("RMTREE: %s (dry-run)" % directory)
|
|
153
|
+
else:
|
|
154
|
+
print("RMTREE: %s" % directory)
|
|
155
|
+
directory.rmtree_p()
|
|
156
|
+
|
|
157
|
+
def cleanup_files(patterns, dry_run=False, workdir="."):
|
|
158
|
+
"""Remove files or files selected by file patterns.
|
|
159
|
+
Skips removal if file does not exist.
|
|
160
|
+
|
|
161
|
+
:param patterns: File patterns, like "**/*.pyc" (as list).
|
|
162
|
+
:param dry_run: Dry-run mode indicator (as bool).
|
|
163
|
+
:param workdir: Current work directory (default=".")
|
|
164
|
+
"""
|
|
165
|
+
current_dir = Path(workdir)
|
|
166
|
+
python_basedir = Path(Path(sys.executable).dirname()).joinpath("..").abspath()
|
|
167
|
+
error_message = None
|
|
168
|
+
error_count = 0
|
|
169
|
+
for file_pattern in patterns:
|
|
170
|
+
for file_ in path_glob(file_pattern, current_dir):
|
|
171
|
+
if file_.abspath().startswith(python_basedir):
|
|
172
|
+
# -- PROTECT CURRENTLY USED VIRTUAL ENVIRONMENT:
|
|
173
|
+
continue
|
|
174
|
+
|
|
175
|
+
if dry_run:
|
|
176
|
+
print("REMOVE: %s (dry-run)" % file_)
|
|
177
|
+
else:
|
|
178
|
+
print("REMOVE: %s" % file_)
|
|
179
|
+
try:
|
|
180
|
+
file_.remove_p()
|
|
181
|
+
except os.error as e:
|
|
182
|
+
message = "%s: %s" % (e.__class__.__name__, e)
|
|
183
|
+
print(message + " basedir: "+ python_basedir)
|
|
184
|
+
error_count += 1
|
|
185
|
+
if not error_message:
|
|
186
|
+
error_message = message
|
|
187
|
+
if False and error_message:
|
|
188
|
+
class CleanupError(RuntimeError): pass
|
|
189
|
+
raise CleanupError(error_message)
|
|
190
|
+
|
|
191
|
+
def path_glob(pattern, current_dir=None):
|
|
192
|
+
"""Use pathlib for ant-like patterns, like: "**/*.py"
|
|
193
|
+
|
|
194
|
+
:param pattern: File/directory pattern to use (as string).
|
|
195
|
+
:param current_dir: Current working directory (as Path, pathlib.Path, str)
|
|
196
|
+
:return Resolved Path (as path.Path).
|
|
197
|
+
"""
|
|
198
|
+
if not current_dir:
|
|
199
|
+
current_dir = pathlib.Path.cwd()
|
|
200
|
+
elif not isinstance(current_dir, pathlib.Path):
|
|
201
|
+
# -- CASE: string, path.Path (string-like)
|
|
202
|
+
current_dir = pathlib.Path(str(current_dir))
|
|
203
|
+
|
|
204
|
+
for p in current_dir.glob(pattern):
|
|
205
|
+
yield Path(str(p))
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
# -----------------------------------------------------------------------------
|
|
209
|
+
# TASK CONFIGURATION:
|
|
210
|
+
# -----------------------------------------------------------------------------
|
|
211
|
+
namespace = Collection(clean, clean_all)
|
|
212
|
+
namespace.configure({
|
|
213
|
+
"clean": {
|
|
214
|
+
"directories": [],
|
|
215
|
+
"files": [
|
|
216
|
+
"*.bak", "*.log", "*.tmp",
|
|
217
|
+
"**/.DS_Store", "**/*.~*~", # -- MACOSX
|
|
218
|
+
],
|
|
219
|
+
"extra_directories": [],
|
|
220
|
+
"extra_files": [],
|
|
221
|
+
},
|
|
222
|
+
"clean_all": {
|
|
223
|
+
"directories": [".venv*", ".tox", "downloads", "tmp"],
|
|
224
|
+
"files": [],
|
|
225
|
+
"extra_directories": [],
|
|
226
|
+
"extra_files": [],
|
|
227
|
+
},
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
# -- SUPPORT ADDITIONAL CLEANUP TASKS (which are called by ``clean`` task)
|
|
231
|
+
cleanup_tasks = Collection("cleanup_tasks")
|
|
232
|
+
cleanup_tasks.add_task(clean_python)
|
|
233
|
+
|
|
234
|
+
cleanup_all_tasks = Collection("cleanup_all_tasks")
|
|
235
|
+
|
|
236
|
+
# -----------------------------------------------------------------------------
|
|
237
|
+
# TASK CONFIGURATION HELPERS: Can be used from other task modules
|
|
238
|
+
# -----------------------------------------------------------------------------
|
|
239
|
+
def config_add_cleanup_dirs(directories):
|
|
240
|
+
cleanup_directories = namespace._configuration["clean"]["directories"]
|
|
241
|
+
cleanup_directories.extend(directories)
|
|
242
|
+
|
|
243
|
+
def config_add_cleanup_files(files):
|
|
244
|
+
cleanup_files = namespace._configuration["clean"]["files"]
|
|
245
|
+
cleanup_files.extend(files)
|
|
246
|
+
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Provides tasks to build documentation with sphinx, etc.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import absolute_import, print_function
|
|
7
|
+
from invoke import task, Collection
|
|
8
|
+
from invoke.util import cd
|
|
9
|
+
from path import Path
|
|
10
|
+
import os.path
|
|
11
|
+
import sys
|
|
12
|
+
|
|
13
|
+
# -- TASK-LIBRARY:
|
|
14
|
+
from .clean import cleanup_tasks, cleanup_dirs
|
|
15
|
+
|
|
16
|
+
# -----------------------------------------------------------------------------
|
|
17
|
+
# TASKS:
|
|
18
|
+
# -----------------------------------------------------------------------------
|
|
19
|
+
@task
|
|
20
|
+
def clean(ctx, dry_run=False):
|
|
21
|
+
"""Cleanup generated document artifacts."""
|
|
22
|
+
basedir = ctx.sphinx.destdir or "build/docs"
|
|
23
|
+
cleanup_dirs([basedir], dry_run=dry_run)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@task(help={
|
|
27
|
+
"builder": "Builder to use (html, ...)",
|
|
28
|
+
"options": "Additional options for sphinx-build",
|
|
29
|
+
})
|
|
30
|
+
def build(ctx, builder="html", options=""):
|
|
31
|
+
"""Build docs with sphinx-build"""
|
|
32
|
+
sourcedir = ctx.config.sphinx.sourcedir
|
|
33
|
+
destdir = Path(ctx.config.sphinx.destdir or "build")/builder
|
|
34
|
+
destdir = destdir.abspath()
|
|
35
|
+
with cd(sourcedir):
|
|
36
|
+
destdir_relative = Path(".").relpathto(destdir)
|
|
37
|
+
command = "sphinx-build {opts} -b {builder} {sourcedir} {destdir}" \
|
|
38
|
+
.format(builder=builder, sourcedir=".",
|
|
39
|
+
destdir=destdir_relative, opts=options)
|
|
40
|
+
ctx.run(command)
|
|
41
|
+
|
|
42
|
+
@task
|
|
43
|
+
def linkcheck(ctx):
|
|
44
|
+
"""Check if all links are corect."""
|
|
45
|
+
build(ctx, builder="linkcheck")
|
|
46
|
+
|
|
47
|
+
@task
|
|
48
|
+
def browse(ctx):
|
|
49
|
+
"""Open documentation in web browser."""
|
|
50
|
+
page_html = Path(ctx.config.sphinx.destdir)/"html"/"index.html"
|
|
51
|
+
if not page_html.exists():
|
|
52
|
+
build(ctx, builder="html")
|
|
53
|
+
assert page_html.exists()
|
|
54
|
+
open_cmd = "open" # -- WORKS ON: MACOSX
|
|
55
|
+
if sys.platform.startswith("win"):
|
|
56
|
+
open_cmd = "start"
|
|
57
|
+
ctx.run("{open} {page_html}".format(open=open_cmd, page_html=page_html))
|
|
58
|
+
# ctx.run('python -m webbrowser -t {page_html}'.format(page_html=page_html))
|
|
59
|
+
# -- DISABLED:
|
|
60
|
+
# import webbrowser
|
|
61
|
+
# print("Starting webbrowser with page=%s" % page_html)
|
|
62
|
+
# webbrowser.open(str(page_html))
|
|
63
|
+
|
|
64
|
+
@task(help = {"dest": "Destination directory to save docs"})
|
|
65
|
+
def save(ctx, dest="docs.html", format="html"):
|
|
66
|
+
"""Save/update docs under destination directory."""
|
|
67
|
+
print("STEP: Generate docs in HTML format")
|
|
68
|
+
build(ctx, builder=format)
|
|
69
|
+
|
|
70
|
+
print("STEP: Save docs under %s/" % dest)
|
|
71
|
+
source_dir = Path(ctx.config.sphinx.destdir)/format
|
|
72
|
+
Path(dest).rmtree_p()
|
|
73
|
+
source_dir.copytree(dest)
|
|
74
|
+
|
|
75
|
+
# -- POST-PROCESSING: Polish up.
|
|
76
|
+
for part in [ ".buildinfo", ".doctrees" ]:
|
|
77
|
+
partpath = Path(dest)/part
|
|
78
|
+
if partpath.isdir():
|
|
79
|
+
partpath.rmtree_p()
|
|
80
|
+
elif partpath.exists():
|
|
81
|
+
partpath.remove_p()
|
|
82
|
+
|
|
83
|
+
# -----------------------------------------------------------------------------
|
|
84
|
+
# TASK CONFIGURATION:
|
|
85
|
+
# -----------------------------------------------------------------------------
|
|
86
|
+
namespace = Collection(clean, linkcheck, browse, save)
|
|
87
|
+
namespace.add_task(build, default=True)
|
|
88
|
+
namespace.configure({
|
|
89
|
+
"sphinx": {
|
|
90
|
+
"sourcedir": "docs",
|
|
91
|
+
"destdir": "build/docs"
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
# -- ADD CLEANUP TASK:
|
|
96
|
+
cleanup_tasks.add_task(clean, "clean_docs")
|
|
97
|
+
cleanup_tasks.configure(namespace.configuration())
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
# INVOKE PYTHON PACKAGE REQUIREMENTS: For tasks
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# DESCRIPTION:
|
|
5
|
+
# pip install -r <THIS_FILE>
|
|
6
|
+
#
|
|
7
|
+
# SEE ALSO:
|
|
8
|
+
# * http://www.pip-installer.org/
|
|
9
|
+
# ============================================================================
|
|
10
|
+
|
|
11
|
+
invoke >= 0.14.0
|
|
12
|
+
six >= 1.10.0
|
|
13
|
+
path.py >= 8.2.1
|
|
14
|
+
pathlib; python_version <= '3.4'
|
|
15
|
+
|
|
16
|
+
# For cleanup of python files: py.cleanup
|
|
17
|
+
pycmd
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Invoke test tasks.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import print_function
|
|
7
|
+
from invoke import task, Collection
|
|
8
|
+
import os.path
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
# -- TASK-LIBRARY:
|
|
12
|
+
from .clean import cleanup_tasks, cleanup_dirs, cleanup_files
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# ---------------------------------------------------------------------------
|
|
16
|
+
# TASKS
|
|
17
|
+
# ---------------------------------------------------------------------------
|
|
18
|
+
@task(name="all", help={
|
|
19
|
+
"args": "Command line args for test run.",
|
|
20
|
+
})
|
|
21
|
+
def test_all(ctx, args="", options=""):
|
|
22
|
+
"""Run all tests (default)."""
|
|
23
|
+
pytest_args = select_by_prefix(args, ctx.pytest.scopes)
|
|
24
|
+
behave_args = select_by_prefix(args, ctx.behave_test.scopes)
|
|
25
|
+
pytest_should_run = not args or (args and pytest_args)
|
|
26
|
+
behave_should_run = not args or (args and behave_args)
|
|
27
|
+
if pytest_should_run:
|
|
28
|
+
pytest(ctx, pytest_args, options=options)
|
|
29
|
+
if behave_should_run:
|
|
30
|
+
behave(ctx, behave_args, options=options)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@task
|
|
34
|
+
def clean(ctx, dry_run=False):
|
|
35
|
+
"""Cleanup (temporary) test artifacts."""
|
|
36
|
+
directories = ctx.test.clean.directories or []
|
|
37
|
+
files = ctx.test.clean.files or []
|
|
38
|
+
cleanup_dirs(directories, dry_run=dry_run)
|
|
39
|
+
cleanup_files(files, dry_run=dry_run)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@task(name="unit")
|
|
43
|
+
def unittest(ctx, args="", options=""):
|
|
44
|
+
"""Run unit tests."""
|
|
45
|
+
pytest(ctx, args, options)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@task
|
|
49
|
+
def pytest(ctx, args="", options=""):
|
|
50
|
+
"""Run unit tests."""
|
|
51
|
+
args = args or ctx.pytest.args
|
|
52
|
+
options = options or ctx.pytest.options
|
|
53
|
+
ctx.run("pytest {options} {args}".format(options=options, args=args))
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@task(help={
|
|
57
|
+
"args": "Command line args for behave",
|
|
58
|
+
"format": "Formatter to use (progress, pretty, ...)",
|
|
59
|
+
})
|
|
60
|
+
def behave(ctx, args="", format="", options=""):
|
|
61
|
+
"""Run behave tests."""
|
|
62
|
+
format = format or ctx.behave_test.format
|
|
63
|
+
options = options or ctx.behave_test.options
|
|
64
|
+
args = args or ctx.behave_test.args
|
|
65
|
+
if os.path.exists("bin/behave"):
|
|
66
|
+
behave = "{python} bin/behave".format(python=sys.executable)
|
|
67
|
+
else:
|
|
68
|
+
behave = "{python} -m behave".format(python=sys.executable)
|
|
69
|
+
|
|
70
|
+
for group_args in grouped_by_prefix(args, ctx.behave_test.scopes):
|
|
71
|
+
ctx.run("{behave} -f {format} {options} {args}".format(
|
|
72
|
+
behave=behave, format=format, options=options, args=group_args))
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@task(help={
|
|
76
|
+
"args": "Tests to run (empty: all)",
|
|
77
|
+
"report": "Coverage report format to use (report, html, xml)",
|
|
78
|
+
})
|
|
79
|
+
def coverage(ctx, args="", report="report", append=False):
|
|
80
|
+
"""Determine test coverage (run pytest, behave)"""
|
|
81
|
+
append = append or ctx.coverage.append
|
|
82
|
+
report_formats = ctx.coverage.report_formats or []
|
|
83
|
+
if report not in report_formats:
|
|
84
|
+
report_formats.insert(0, report)
|
|
85
|
+
opts = []
|
|
86
|
+
if append:
|
|
87
|
+
opts.append("--append")
|
|
88
|
+
|
|
89
|
+
pytest_args = select_by_prefix(args, ctx.pytest.scopes)
|
|
90
|
+
behave_args = select_by_prefix(args, ctx.behave_test.scopes)
|
|
91
|
+
pytest_should_run = not args or (args and pytest_args)
|
|
92
|
+
behave_should_run = not args or (args and behave_args)
|
|
93
|
+
if not args:
|
|
94
|
+
behave_args = ctx.behave_test.args or "features"
|
|
95
|
+
if isinstance(pytest_args, list):
|
|
96
|
+
pytest_args = " ".join(pytest_args)
|
|
97
|
+
if isinstance(behave_args, list):
|
|
98
|
+
behave_args = " ".join(behave_args)
|
|
99
|
+
|
|
100
|
+
# -- RUN TESTS WITH COVERAGE:
|
|
101
|
+
if pytest_should_run:
|
|
102
|
+
ctx.run("coverage run {options} -m pytest {args}".format(
|
|
103
|
+
args=pytest_args, options=" ".join(opts)))
|
|
104
|
+
if behave_should_run:
|
|
105
|
+
behave_options = ctx.behave_test.coverage_options or ""
|
|
106
|
+
os.environ["COVERAGE_PROCESS_START"] = os.path.abspath(".coveragerc")
|
|
107
|
+
behave(ctx, args=behave_args, options=behave_options)
|
|
108
|
+
del os.environ["COVERAGE_PROCESS_START"]
|
|
109
|
+
|
|
110
|
+
# -- POST-PROCESSING:
|
|
111
|
+
ctx.run("coverage combine")
|
|
112
|
+
for report_format in report_formats:
|
|
113
|
+
ctx.run("coverage {report_format}".format(report_format=report_format))
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
# ---------------------------------------------------------------------------
|
|
117
|
+
# UTILITIES:
|
|
118
|
+
# ---------------------------------------------------------------------------
|
|
119
|
+
def select_prefix_for(arg, prefixes):
|
|
120
|
+
for prefix in prefixes:
|
|
121
|
+
if arg.startswith(prefix):
|
|
122
|
+
return prefix
|
|
123
|
+
return os.path.dirname(arg)
|
|
124
|
+
|
|
125
|
+
def select_by_prefix(args, prefixes):
|
|
126
|
+
selected = []
|
|
127
|
+
for arg in args.strip().split():
|
|
128
|
+
assert not arg.startswith("-"), "REQUIRE: arg, not options"
|
|
129
|
+
scope = select_prefix_for(arg, prefixes)
|
|
130
|
+
if scope:
|
|
131
|
+
selected.append(arg)
|
|
132
|
+
return " ".join(selected)
|
|
133
|
+
|
|
134
|
+
def grouped_by_prefix(args, prefixes):
|
|
135
|
+
"""Group behave args by (directory) scope into multiple test-runs."""
|
|
136
|
+
group_args = []
|
|
137
|
+
current_scope = None
|
|
138
|
+
for arg in args.strip().split():
|
|
139
|
+
assert not arg.startswith("-"), "REQUIRE: arg, not options"
|
|
140
|
+
scope = select_prefix_for(arg, prefixes)
|
|
141
|
+
if scope != current_scope:
|
|
142
|
+
if group_args:
|
|
143
|
+
# -- DETECTED GROUP-END:
|
|
144
|
+
yield " ".join(group_args)
|
|
145
|
+
group_args = []
|
|
146
|
+
current_scope = scope
|
|
147
|
+
group_args.append(arg)
|
|
148
|
+
if group_args:
|
|
149
|
+
yield " ".join(group_args)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
# ---------------------------------------------------------------------------
|
|
153
|
+
# TASK MANAGEMENT / CONFIGURATION
|
|
154
|
+
# ---------------------------------------------------------------------------
|
|
155
|
+
namespace = Collection(clean, unittest, pytest, behave, coverage)
|
|
156
|
+
namespace.add_task(test_all, default=True)
|
|
157
|
+
namespace.configure({
|
|
158
|
+
"test": {
|
|
159
|
+
"clean": {
|
|
160
|
+
"directories": [
|
|
161
|
+
".cache", "assets", # -- TEST RUNS
|
|
162
|
+
"__WORKDIR__", "reports", "test_results", # -- BEHAVE test
|
|
163
|
+
],
|
|
164
|
+
"files": [
|
|
165
|
+
".coverage", ".coverage.*",
|
|
166
|
+
"report.html",
|
|
167
|
+
"rerun*.txt", "rerun*.featureset", "testrun*.json",
|
|
168
|
+
],
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
"pytest": {
|
|
172
|
+
"scopes": ["test", "tests"],
|
|
173
|
+
"args": "",
|
|
174
|
+
"options": "", # -- NOTE: Overide in configfile "invoke.yaml"
|
|
175
|
+
},
|
|
176
|
+
# "behave_test": behave.namespace._configuration["behave_test"],
|
|
177
|
+
"behave_test": {
|
|
178
|
+
"scopes": ["features", "issue.features"],
|
|
179
|
+
"args": "features issue.features",
|
|
180
|
+
"format": "progress",
|
|
181
|
+
"options": "", # -- NOTE: Overide in configfile "invoke.yaml"
|
|
182
|
+
"coverage_options": "",
|
|
183
|
+
},
|
|
184
|
+
"coverage": {
|
|
185
|
+
"append": False,
|
|
186
|
+
"report_formats": ["report", "html"],
|
|
187
|
+
},
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
# -- ADD CLEANUP TASK:
|
|
191
|
+
cleanup_tasks.add_task(clean, "clean_test")
|
|
192
|
+
cleanup_tasks.configure(namespace.configuration())
|