-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
test_pyenv.py
41 lines (30 loc) · 1.13 KB
/
test_pyenv.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
#
"""Tests for pyenv.py"""
import sys
import time
import pytest
from spyder.config.base import running_in_ci
from spyder.utils.programs import find_program
from spyder.utils.pyenv import get_list_pyenv_envs, get_list_pyenv_envs_cache
if not find_program('pyenv'):
pytest.skip("Requires pyenv to be installed", allow_module_level=True)
@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")
def test_get_list_pyenv_envs():
output = get_list_pyenv_envs()
expected_envs = ['pyenv: 3.8.1']
assert set(expected_envs) == set(output.keys())
@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")
def test_get_list_pyenv_envs_cache():
time0 = time.time()
output = get_list_pyenv_envs_cache()
time1 = time.time()
assert output != {}
assert (time1 - time0) < 0.01