Skip to content

Commit

Permalink
Merge pull request #10692 from t20100/fix-install-pre
Browse files Browse the repository at this point in the history
Fix `pip install --pre` for packages with dependencies defined in `pyproject.toml` and `setup.py`
  • Loading branch information
sbidoul authored Jul 10, 2022
2 parents 8be911b + 23b09c1 commit 99818e1
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/10222.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix ``pip install --pre`` for packages with pre-release build dependencies defined both in ``pyproject.toml``'s ``build-system.requires`` and ``setup.py``'s ``setup_requires``.
39 changes: 39 additions & 0 deletions tests/functional/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,45 @@ def test_editable_install__local_dir_setup_requires_with_pyproject(
script.pip("install", "--find-links", shared_data.find_links, "-e", local_dir)


def test_install_pre__setup_requires_with_pyproject(
script: PipTestEnvironment, shared_data: TestData, common_wheels: Path
) -> None:
"""
Test installing with a pre-release build dependency declared in both
setup.py and pyproject.toml.
https://github.com/pypa/pip/issues/10573
"""
depends_package = "prerelease_dependency"
depends_path = create_basic_wheel_for_package(script, depends_package, "1.0.0a1")

local_dir = script.scratch_path.joinpath("temp")
local_dir.mkdir()
pyproject_path = local_dir.joinpath("pyproject.toml")
pyproject_path.write_text(
"[build-system]\n"
f'requires = ["setuptools", "wheel", "{depends_package}"]\n'
'build-backend = "setuptools.build_meta"\n'
)
setup_py_path = local_dir.joinpath("setup.py")
setup_py_path.write_text(
"from setuptools import setup\n"
f"setup(name='dummy', setup_requires=['{depends_package}'])\n"
)

script.pip(
"install",
"--pre",
"--no-cache-dir",
"--no-index",
"--find-links",
common_wheels,
"--find-links",
depends_path.parent,
local_dir,
)


@pytest.mark.network
def test_upgrade_argparse_shadowed(script: PipTestEnvironment) -> None:
# If argparse is installed - even if shadowed for imported - we support
Expand Down

0 comments on commit 99818e1

Please sign in to comment.