Example #1
0
def execute(args):
    p, _args = parse_args(args)
    test = True

    try:
        if not any(os.path.splitext(_args.recipe_or_package_file_path)[1] in ext for ext in CONDA_TARBALL_EXTENSIONS):
            # --output silences console output here
            thing_to_debug = render_execute(args, print_results=False)
            test = False
        else:
            thing_to_debug = _args.recipe_or_package_file_path
        activation_string = api.debug(thing_to_debug, verbose=(not _args.activate_string_only), **_args.__dict__)

        if not _args.activate_string_only:
            print("#" * 80)
            if test:
                print("Test environment created for debugging.  To enter a debugging environment:\n")
            else:
                print("Build and/or host environments created for debugging.  To enter a debugging environment:\n")
        print(activation_string)
        if not _args.activate_string_only:
            if test:
                test_file = "conda_test_runner.sh" if on_win else "conda_test_runner.sh"
                print("To run your tests, you might want to start with running the {} file.".format(test_file))
            else:
                build_file = "conda_build.bat" if on_win else "conda_build.sh"
                print("To run your build, you might want to start with running the {} file.".format(build_file))
            print("#" * 80)

    except ValueError as e:
        print(str(e))
        sys.exit(1)
Example #2
0
def execute():
    parser = get_parser()
    args = parser.parse_args()

    try:
        activation_string = api.debug(args.recipe_or_package_file_path,
                                      verbose=(not args.activate_string_only),
                                      **args.__dict__)

        if not args.activate_string_only:
            print("#" * 80)
            print(
                "Test environment created for debugging.  To enter a debugging environment:\n"
            )

        print(activation_string)
        if not args.activate_string_only:
            test_file = "conda_test_runner.bat" if on_win else "conda_test_runner.sh"
            print(
                f"To run your tests, you might want to start with running the {test_file} file."
            )
            print("#" * 80)

    except ValueError as e:
        print(f"Error: conda-debug encountered the following error:\n{e}",
              file=sys.stderr)
        sys.exit(1)
Example #3
0
def execute(args):
    p, _args = parse_args(args)
    test = True

    try:
        if not any(os.path.splitext(_args.recipe_or_package_file_path)[1] in ext for ext in CONDA_TARBALL_EXTENSIONS):
            # --output silences console output here
            thing_to_debug = render_execute(args, print_results=False)
            test = False
        else:
            thing_to_debug = _args.recipe_or_package_file_path
        activation_string = api.debug(thing_to_debug, verbose=(not _args.activate_string_only), **_args.__dict__)

        if not _args.activate_string_only:
            print("#" * 80)
            if test:
                print("Test environment created for debugging.  To enter a debugging environment:\n")
            else:
                print("Build and/or host environments created for debugging.  To enter a debugging environment:\n")
        print(activation_string)
        if not _args.activate_string_only:
            if test:
                test_file = "conda_test_runner.sh" if on_win else "conda_test_runner.sh"
                print("To run your tests, you might want to start with running the {} file.".format(test_file))
            else:
                build_file = "bld.bat" if on_win else "conda_build.sh"
                print("To run your build, you might want to start with running the {} file.".format(build_file))
            print("#" * 80)

    except ValueError as e:
        print(str(e))
        sys.exit(1)
Example #4
0
def test_debug_package_custom_path(testing_workdir):
    activation_string = api.debug(tarball_path, path=testing_workdir)
    _, work_dir, _, src_command, env_activation_script = activation_string.split(
    )
    _shell_cmd = shell_cmd + [' '.join((src_command, env_activation_script))]
    subprocess.check_call(_shell_cmd, cwd=work_dir)
    check_build_files_present(work_dir, False)
    check_test_files_present(work_dir, True)
    assert_correct_folders(work_dir, build=False)
Example #5
0
def test_specific_output():
    activation_string = api.debug(ambiguous_recipe_path, output_id="output1*")
    _, work_dir, _, src_command, env_activation_script = activation_string.split(
    )
    _shell_cmd = shell_cmd + [' '.join((src_command, env_activation_script))]
    subprocess.check_call(_shell_cmd, cwd=work_dir)
    check_build_files_present(work_dir, True)
    check_test_files_present(work_dir, False)
    assert_correct_folders(work_dir, build=True)
Example #6
0
def test_debug_package_default_path(testing_config):
    activation_string = api.debug(tarball_path, config=testing_config)
    _, work_dir, _, src_command, env_activation_script = activation_string.split(
    )
    shell_cmd.append(' '.join((src_command, env_activation_script)))
    subprocess.check_call(shell_cmd, cwd=work_dir)
    check_build_files_present(work_dir, False)
    check_test_files_present(work_dir, True)
    assert_correct_folders(work_dir, build=False)
Example #7
0
def test_debug_recipe_default_path(testing_config):
    activation_string = api.debug(recipe_path, config=testing_config)
    assert activation_string and "debug_1" in activation_string
    _, work_dir, _, src_command, env_activation_script = activation_string.split(
    )
    _shell_cmd = shell_cmd + [' '.join((src_command, env_activation_script))]
    subprocess.check_call(_shell_cmd, cwd=work_dir)
    check_build_files_present(work_dir, True)
    check_test_files_present(work_dir, False)
    assert_correct_folders(work_dir)
Example #8
0
def test_debug_recipe_custom_path(testing_workdir):
    activation_string = api.debug(recipe_path, path=testing_workdir)
    assert activation_string and "debug_1" not in activation_string
    _, work_dir, _, src_command, env_activation_script = activation_string.split(
    )
    shell_cmd.append(' '.join((src_command, env_activation_script)))
    subprocess.check_call(shell_cmd, cwd=work_dir)
    check_build_files_present(work_dir, True)
    check_test_files_present(work_dir, False)
    assert_correct_folders(work_dir)
Example #9
0
def test_error_on_unmatched_output():
    with pytest.raises(ValueError):
        api.debug(ambiguous_recipe_path, output_id="frank")
Example #10
0
def test_error_on_ambiguous_output():
    with pytest.raises(ValueError):
        api.debug(ambiguous_recipe_path)