action="store_true",
                      default=False,
                      help='Output Subunit test results to a file')

    parser.add_option("--subunit-file",
                      dest="subunit_filename",
                      default=None,
                      help='Write Subunit data to this file. Defaults to '
                           'subunit.bin')

    parser.add_option("--failfast",
                      dest="failfast",
                      default=False,
                      action="store_true",
                      help='Stop running in the first failure')

    parser.add_option("--pdb",
                      dest="auto_pdb",
                      default=False,
                      action="store_true",
                      help='Launches an interactive debugger upon error')
    return parser.parse_args()


if __name__ == "__main__":
    options, args = _get_args()
    (base_dir, scenarios, what_to_run) = _bdd_utils.get_what_to_run_by_env(os.environ)
    if len(what_to_run) > 1:
        raise Exception("Lettuce can't run more than one file now")
    _bdd_utils.fix_win_drive(what_to_run[0])
    _LettuceRunner(base_dir, what_to_run[0], scenarios, options).run()
示例#2
0
if __name__ == "__main__":
    # TODO: support all other params instead

    class _Null(Formatter):
        """
        Null formater to prevent stdout output
        """
        pass

    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
示例#3
0
        return features_to_run


if __name__ == "__main__":
    # TODO: support all other params instead

    class _Null(Formatter):
        """
        Null formater to prevent stdout output
        """
        pass

    command_args = list(filter(None, sys.argv[1:]))
    if command_args:
        _bdd_utils.fix_win_drive(command_args[0])
    my_config = configuration.Configuration(command_args=command_args)
    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
    (base_dir, what_to_run) = _bdd_utils.get_path_by_env(os.environ)
    features = set()
    for feature in what_to_run:
        if os.path.isfile(feature) or glob.glob(
                os.path.join(feature, "*.feature")):  # File of folder with "features"  provided, load it
            features.add(feature)
        elif os.path.isdir(feature):
            features |= set(_get_dirs_to_run(feature))  # Find "features" subfolder
    my_config.paths = list(features)
示例#4
0
                      default=False,
                      help='Output Subunit test results to a file')

    parser.add_option("--subunit-file",
                      dest="subunit_filename",
                      default=None,
                      help='Write Subunit data to this file. Defaults to '
                      'subunit.bin')

    parser.add_option("--failfast",
                      dest="failfast",
                      default=False,
                      action="store_true",
                      help='Stop running in the first failure')

    parser.add_option("--pdb",
                      dest="auto_pdb",
                      default=False,
                      action="store_true",
                      help='Launches an interactive debugger upon error')
    return parser.parse_args()


if __name__ == "__main__":
    options, args = _get_args()
    (base_dir, scenarios,
     what_to_run) = _bdd_utils.get_what_to_run_by_env(os.environ)
    if len(what_to_run) > 1:
        raise Exception("Lettuce can't run more than one file now")
    _bdd_utils.fix_win_drive(what_to_run[0])
    _LettuceRunner(base_dir, what_to_run[0], scenarios, options).run()