-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
82 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,64 @@ def test_local_extras_install(pipenv_instance_pypi): | |
assert "six" in p.lockfile["default"] | ||
|
||
|
||
@pytest.mark.extras | ||
@pytest.mark.install | ||
@pytest.mark.local | ||
def test_local_extras_install_alternate(pipenv_instance_pypi): | ||
"""Ensure local package with extras installs correctly using pyproject.toml.""" | ||
with pipenv_instance_pypi() as p: | ||
# Create pyproject.toml | ||
pyproject_toml = os.path.join(p.path, "pyproject.toml") | ||
with open(pyproject_toml, "w") as fh: | ||
contents = """ | ||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
[project] | ||
name = "testpipenv" | ||
version = "0.1" | ||
description = "Pipenv Test Package" | ||
authors = [{name = "Pipenv Test", email = "[email protected]"}] | ||
requires-python = ">=3.8" | ||
[project.optional-dependencies] | ||
dev = ["six"] | ||
""".strip() | ||
fh.write(contents) | ||
|
||
# Create basic package structure | ||
pkg_dir = os.path.join(p.path, "testpipenv") | ||
os.makedirs(pkg_dir) | ||
with open(os.path.join(pkg_dir, "__init__.py"), "w") as fh: | ||
fh.write("") | ||
|
||
# Test with both Pipfile syntax and direct install | ||
for install_method in ["pipfile", "direct"]: | ||
if install_method == "pipfile": | ||
with open(os.path.join(p.path, "Pipfile"), "w") as fh: | ||
fh.write(""" | ||
[packages] | ||
testpipenv = {path = ".", editable = true, extras = ["dev"]} | ||
[dev-packages] | ||
""".strip()) | ||
c = p.pipenv("install") | ||
else: | ||
p.lockfile_path.unlink() | ||
c = p.pipenv("install -e .[dev]") | ||
|
||
assert c.returncode == 0 | ||
assert "testpipenv" in p.lockfile["default"] | ||
assert p.lockfile["default"]["testpipenv"]["extras"] == ["dev"] | ||
assert "six" in p.lockfile["default"] | ||
|
||
if install_method == "pipfile": | ||
assert p.pipfile["packages"]["testpipenv"]["extras"] == ["dev"] | ||
|
||
c = p.pipenv("uninstall --all") | ||
assert c.returncode == 0 | ||
|
||
@pytest.mark.local | ||
@pytest.mark.install | ||
@pytest.mark.needs_internet | ||
|