-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In `test_new.test_pip_cmd_option`, check that the correct pip-equivalent command is being invoked in the subprocess call.
- Loading branch information
1 parent
8bc10c9
commit 24e3585
Showing
4 changed files
with
36 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from pew.pew import pew | ||
from pew.pew import main | ||
|
||
pew() | ||
main() |
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
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,13 +1,26 @@ | ||
from unittest.mock import patch | ||
from uuid import uuid4 | ||
|
||
import pytest | ||
|
||
from pew._utils import invoke_pew | ||
from pew.pew import pew | ||
|
||
|
||
@pytest.fixture | ||
def mocked_check_call(): | ||
with patch("pew.pew.check_call") as mock: | ||
yield mock | ||
|
||
|
||
@pytest.mark.usefixtures("workon_home") | ||
def test_pip_option(): | ||
try: | ||
invoke_pew("new", "--pip-cmd", "pip", str(uuid4())) | ||
except Exception as e: | ||
pytest.fail(str(e)) | ||
@pytest.mark.parametrize( | ||
"pip_cmd,exp_call", | ||
[ | ||
("pip", ["pip", "install", "pew"]), | ||
("uv", ["uv", "pip", "install", "pew"]), | ||
] | ||
) | ||
def test_pip_cmd_option(mocked_check_call, pip_cmd, exp_call): | ||
pew(["new", "-d", "--pip-cmd", pip_cmd, "-i", "pew", str(uuid4())]) | ||
assert mocked_check_call.called | ||
assert mocked_check_call.call_args[0][0] == exp_call |