-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add warning to 'fides deploy' when installed outside of a virtual env…
…ironment (#2641)
- Loading branch information
Showing
4 changed files
with
58 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import pytest | ||
from unittest import mock | ||
|
||
from fides.core import deploy | ||
|
||
|
@@ -23,3 +24,21 @@ def test_convert_semver_to_list(self): | |
) | ||
def test_compare_semvers(self, semver_1, semver_2, expected): | ||
assert deploy.compare_semvers(semver_1, semver_2) is expected | ||
|
||
@mock.patch("fides.core.deploy.sys") | ||
def test_check_virtualenv(self, mock_sys): | ||
# Emulate non-virtual environment | ||
mock_sys.prefix = ( | ||
"/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.9" | ||
) | ||
mock_sys.base_prefix = ( | ||
"/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.9" | ||
) | ||
assert deploy.check_virtualenv() == False | ||
|
||
# Emulate virtual environment | ||
mock_sys.prefix = "/Users/fidesuser/fides/venv" | ||
mock_sys.base_prefix = ( | ||
"/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.9" | ||
) | ||
assert deploy.check_virtualenv() == True |