-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure develop flag is respected for git packages (#1321)
Resolves: #1080
- Loading branch information
Showing
2 changed files
with
39 additions
and
4 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 |
---|---|---|
@@ -1,12 +1,26 @@ | ||
import pytest | ||
|
||
from poetry.installation.pip_installer import PipInstaller | ||
from poetry.io import NullIO | ||
from poetry.packages.package import Package | ||
from poetry.utils.env import NullEnv | ||
|
||
|
||
def test_requirement(): | ||
installer = PipInstaller(NullEnv(), NullIO()) | ||
@pytest.fixture | ||
def package_git(): | ||
package = Package("demo", "1.0.0") | ||
package.source_type = "git" | ||
package.source_url = "[email protected]:demo/demo.git" | ||
package.source_reference = "master" | ||
return package | ||
|
||
|
||
@pytest.fixture | ||
def installer(): | ||
return PipInstaller(NullEnv(), NullIO()) | ||
|
||
|
||
def test_requirement(installer): | ||
package = Package("ipython", "7.5.0") | ||
package.hashes = [ | ||
"md5:dbdc53e3918f28fa335a173432402a00", | ||
|
@@ -22,3 +36,19 @@ def test_requirement(): | |
) | ||
|
||
assert expected == result | ||
|
||
|
||
def test_requirement_git_develop_false(installer, package_git): | ||
package_git.develop = False | ||
result = installer.requirement(package_git) | ||
expected = "[email protected]:demo/demo.git@master#egg=demo" | ||
|
||
assert expected == result | ||
|
||
|
||
def test_requirement_git_develop_true(installer, package_git): | ||
package_git.develop = True | ||
result = installer.requirement(package_git) | ||
expected = ["-e", "[email protected]:demo/demo.git@master#egg=demo"] | ||
|
||
assert expected == result |