Skip to content

Commit

Permalink
Add test to show that multiple setup files in source list is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
Walter-Gates-Bose committed Apr 15, 2024
1 parent 19607b9 commit 2f5e3e3
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions tests/test_cli_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3013,6 +3013,55 @@ def test_build_deps_does_not_error_when_setup_included_with_multiple_source_file
assert out.exit_code == 0


@backtracking_resolver_only
@pytest.mark.parametrize("option", ("--all-build-deps", "--build-deps-for=wheel"))
def test_build_deps_does_not_error_when_multiple_setup_included_in_source_files(
fake_dists_with_build_deps,
runner,
tmp_path,
monkeypatch,
current_resolver,
option,
):
"""
Test that passing ``--build-deps-for`` or ``--all-build-deps`` does not emit an
error as long as at least one file in the sources list is a setup file.
"""
src_pkg_path = pathlib.Path(PACKAGES_PATH) / "small_fake_with_build_deps"
# When used as argument to the runner it is not passed to pip
monkeypatch.setenv("PIP_FIND_LINKS", fake_dists_with_build_deps)

pyproject_toml_path = pathlib.Path(tmp_path) / "pyproject.toml"
pyproject_toml_path.write_text("\n")

pyproject_toml_2_path = pathlib.Path(tmp_path) / "pyproject.toml"
pyproject_toml_2_path.write_text("\n")

with runner.isolated_filesystem(tmp_path) as tmp_pkg_path:
shutil.copytree(src_pkg_path, tmp_pkg_path, dirs_exist_ok=True)
out = runner.invoke(
cli,
[
"--allow-unsafe",
"--output-file",
"-",
"--quiet",
"--no-emit-options",
"--no-header",
option,
os.fspath(pyproject_toml_path),
os.fspath(pyproject_toml_2_path)
],
)

exp = (
"--build-deps-for and --all-build-deps can be used only with the "
"setup.py, setup.cfg and pyproject.toml specs."
)
assert exp not in out.stderr
assert out.exit_code == 0


def test_extras_fail_with_requirements_in(runner, tmpdir):
"""
Test that passing ``--extra`` with ``requirements.in`` input file fails.
Expand Down

0 comments on commit 2f5e3e3

Please sign in to comment.