-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from capitalone/dev
Release 2022.7.0
- Loading branch information
Showing
11 changed files
with
129 additions
and
36 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
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
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
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from pathlib import Path | ||
from unittest.mock import patch | ||
|
||
import pytest | ||
|
||
from edgetest.lib import create_environment, path_to_python, run_update | ||
|
||
|
||
@patch("edgetest.lib.platform", autospec=True) | ||
def test_path_to_python(mock_platform): | ||
mock_platform.system.return_value = "Windows" | ||
assert path_to_python("test", "test") == str( | ||
Path("test") / "test" / "Scripts" / "python" | ||
) | ||
|
||
mock_platform.system.return_value = "Unix" | ||
assert path_to_python("test", "test") == str( | ||
Path("test") / "test" / "bin" / "python" | ||
) | ||
|
||
mock_platform.system.side_effect = RuntimeError() | ||
with pytest.raises(RuntimeError): | ||
path_to_python("test", "test") | ||
|
||
|
||
@patch("edgetest.lib.EnvBuilder", autospec=True) | ||
def test_create_environment(mock_env_builder): | ||
create_environment("test", "test", {}) | ||
mock_env_builder.assert_called_with(with_pip=True) | ||
mock_env_builder().create.assert_called_with(env_dir=Path("test", "test")) | ||
|
||
mock_env_builder().create.side_effect = RuntimeError() | ||
with pytest.raises(RuntimeError): | ||
create_environment("test", "test", {}) | ||
|
||
|
||
@patch("edgetest.lib._run_command", autospec=True) | ||
def test_run_update(mock_run): | ||
python_path = path_to_python("test", "test") | ||
run_update("test", "test", ["1", "2"], {"test": "test"}) | ||
mock_run.assert_called_with( | ||
python_path, "-m", "pip", "install", "1", "2", "--upgrade" | ||
) | ||
|
||
mock_run.side_effect = RuntimeError() | ||
with pytest.raises(RuntimeError): | ||
run_update("test", "test", ["1", "2"], {"test": "test"}) |