forked from conda/conda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_priority.py
59 lines (45 loc) · 2.42 KB
/
test_priority.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from unittest import TestCase
import pytest
from conda.base.context import context
from .test_create import (make_temp_env, assert_package_is_installed,
run_command, Commands, get_conda_list_tuple)
class PriorityTest(TestCase):
@pytest.mark.xfail(strict=True, reason="https://github.com/conda-forge/setuptools-feedstock/issues/43")
def test_channel_order_channel_priority_true(self):
with make_temp_env("python=3 pycosat==0.6.1") as prefix:
assert_package_is_installed(prefix, 'python')
assert_package_is_installed(prefix, 'pycosat')
# add conda-forge channel
o, e = run_command(Commands.CONFIG, prefix, "--prepend channels conda-forge", '--json')
assert context.channels == ("conda-forge", "defaults"), o + e
# update --all
update_stdout, _ = run_command(Commands.UPDATE, prefix, '--all')
# pycosat should be in the SUPERCEDED list
superceded_split = update_stdout.split('SUPERCEDED')
assert len(superceded_split) == 2
assert 'pycosat' in superceded_split[1]
# python sys.version should show conda-forge python
python_tuple = get_conda_list_tuple(prefix, "python")
assert python_tuple[3] == 'conda-forge'
# conda list should show pycosat coming from conda-forge
pycosat_tuple = get_conda_list_tuple(prefix, "pycosat")
assert pycosat_tuple[3] == 'conda-forge'
@pytest.mark.timeout(300)
def test_channel_priority_update(self):
"""
This case will fail now
"""
with make_temp_env("python=3 ") as prefix:
assert_package_is_installed(prefix, 'python')
# add conda-forge channel
o, e = run_command(Commands.CONFIG, prefix, "--prepend channels conda-forge", '--json')
assert context.channels == ("conda-forge", "defaults"), o+e
# update python
update_stdout, _ = run_command(Commands.UPDATE, prefix, 'python')
# pycosat should be in the SUPERCEDED list
superceded_split = update_stdout.split('UPDATED')
assert len(superceded_split) == 2
assert 'conda-forge' in superceded_split[1]
# python sys.version should show conda-forge python
python_tuple = get_conda_list_tuple(prefix, "python")
assert python_tuple[3] == 'conda-forge'