-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR: Skip conda and pyenv tests if these tools are not present #17095
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ | |
get_conda_root_prefix, get_list_conda_envs, get_list_conda_envs_cache) | ||
|
||
|
||
CONDA_MISSING = (len(get_list_conda_envs()) == 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please change this line to if not is_anaconda():
pytest.skip() and remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I didn't know the |
||
|
||
if os.name == 'nt': | ||
TEST_PYEXEC = 'c:/miniconda/envs/foobar/python.exe' | ||
else: | ||
|
@@ -35,6 +37,7 @@ def test_add_quotes(): | |
assert output == '/some-path/with-no-spaces' | ||
|
||
|
||
@pytest.mark.skipif(CONDA_MISSING, reason="Requires conda to be installed") | ||
def test_get_conda_activation_script(): | ||
output = get_conda_activation_script(TEST_PYEXEC) | ||
if os.name == 'nt': | ||
|
@@ -43,6 +46,7 @@ def test_get_conda_activation_script(): | |
assert output == '/miniconda/bin/activate' | ||
|
||
|
||
@pytest.mark.skipif(CONDA_MISSING, reason="Requires conda to be installed") | ||
def test_get_conda_env_path(): | ||
output = get_conda_env_path(TEST_PYEXEC) | ||
if os.name == 'nt': | ||
|
@@ -51,6 +55,7 @@ def test_get_conda_env_path(): | |
assert output == '/miniconda/envs/foobar' | ||
|
||
|
||
@pytest.mark.skipif(CONDA_MISSING, reason="Requires conda to be installed") | ||
def test_get_conda_root_prefix(): | ||
output = get_conda_root_prefix(TEST_PYEXEC) | ||
if os.name == 'nt': | ||
|
@@ -61,11 +66,13 @@ def test_get_conda_root_prefix(): | |
assert 'envs' not in get_conda_root_prefix(sys.executable) | ||
|
||
|
||
@pytest.mark.skipif(CONDA_MISSING, reason="Requires conda to be installed") | ||
@pytest.mark.skipif(not running_in_ci(), reason="Only meant for CIs") | ||
def test_find_conda(): | ||
assert find_conda() | ||
|
||
|
||
@pytest.mark.skipif(CONDA_MISSING, reason="Requires conda to be installed") | ||
@pytest.mark.skipif(not running_in_ci(), reason="Only meant for CIs") | ||
def test_get_list_conda_envs(): | ||
output = get_list_conda_envs() | ||
|
@@ -75,6 +82,7 @@ def test_get_list_conda_envs(): | |
assert set(expected_envs) == set(output.keys()) | ||
|
||
|
||
@pytest.mark.skipif(CONDA_MISSING, reason="Requires conda to be installed") | ||
@pytest.mark.skipif(not running_in_ci(), reason="Only meant for CIs") | ||
def test_get_list_conda_envs_cache(): | ||
time0 = time.time() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,10 @@ | |
from spyder.utils.pyenv import get_list_pyenv_envs, get_list_pyenv_envs_cache | ||
|
||
|
||
PYENV_MISSING = (len(get_list_pyenv_envs()) == 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please change this line to if not find_program('pyenv'):
pytest.skip() and remove the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All three requests fulfilled! |
||
|
||
|
||
@pytest.mark.skipif(PYENV_MISSING, reason="Requires pyenv to be installed") | ||
@pytest.mark.skipif(not running_in_ci(), reason="Only meant for CIs") | ||
@pytest.mark.skipif(not sys.platform.startswith('linux'), | ||
reason="Only runs on Linux") | ||
|
@@ -24,6 +28,7 @@ def test_get_list_pyenv_envs(): | |
assert set(expected_envs) == set(output.keys()) | ||
|
||
|
||
@pytest.mark.skipif(PYENV_MISSING, reason="Requires pyenv to be installed") | ||
@pytest.mark.skipif(not running_in_ci(), reason="Only meant for CIs") | ||
@pytest.mark.skipif(not sys.platform.startswith('linux'), | ||
reason="Only runs on Linux") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a function called
is_anaconda
inspyder.config.utils
. So please use that one instead.Also, there's no need to declare an extra constant here for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I didn't know about that function, thanks!
There's a newer comment on the stackoverflow thread, by the way, which suggests that
is_anaconda
should usesys.base_prefix
instead ofsys.prefix
for greater robustness.