command_args = list(filter(None, sys.argv[1:])) if command_args: if "--junit" in command_args: raise Exception( "--junit report type for Behave is unsupported in PyCharm. \n " "See: https://youtrack.jetbrains.com/issue/PY-14219") _bdd_utils.fix_win_drive(command_args[0]) (base_dir, scenario_names, what_to_run) = _bdd_utils.get_what_to_run_by_env(os.environ) for scenario_name in scenario_names: command_args += ["-n", re.escape(scenario_name)] # TODO : rewite pythonic my_config = configuration.Configuration(command_args=command_args) # Temporary workaround to support API changes in 1.2.5 if version.LooseVersion(behave_version) >= version.LooseVersion("1.2.5"): from behave.formatter import _registry _registry.register_as("com.intellij.python.null", _Null) else: from behave.formatter import formatters formatters.register_as(_Null, "com.intellij.python.null") my_config.format = ["com.intellij.python.null" ] # To prevent output to stdout my_config.reporters = [] # To prevent summary to stdout my_config.stdout_capture = False # For test output my_config.stderr_capture = False # For test output features = set()
def test_settings_with_stage(self): config = configuration.Configuration(["--stage=STAGE1"]) eq_("STAGE1_steps", config.steps_dir) eq_("STAGE1_environment.py", config.environment_file)
def test_settings_with_stage_from_envvar(self): os.environ["BEHAVE_STAGE"] = "STAGE2" config = configuration.Configuration() eq_("STAGE2_steps", config.steps_dir) eq_("STAGE2_environment.py", config.environment_file) del os.environ["BEHAVE_STAGE"]
def test_settings_without_stage(self): # -- OR: Setup with default, unnamed stage. assert "BEHAVE_STAGE" not in os.environ config = configuration.Configuration() eq_("steps", config.steps_dir) eq_("environment.py", config.environment_file)