forked from conda/conda
-
Notifications
You must be signed in to change notification settings - Fork 0
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 conda#3306 from HugoTian/priority
fix update idempotency; add tests for channel priority
- Loading branch information
Showing
5 changed files
with
77 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,3 @@ tmpfile.rc | |
.coverage* | ||
*.bz2 | ||
tempfile.rc | ||
*.ipynb |
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 +1 @@ | ||
{"worksheets": [{"cells": []}], "metadata": {"name": "", "signature": ""}, "nbformat": 3, "nbformat_minor": 0} | ||
{"worksheets": [{"cells": []}], "metadata": {"name": "", "signature": ""}, "nbformat": 3, "nbformat_minor": 0} |
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,57 @@ | ||
from unittest import TestCase | ||
import pytest | ||
from .test_create import (make_temp_env, assert_package_is_installed | ||
, run_command, Commands, get_conda_list_tuple) | ||
from conda.base.context import context | ||
|
||
class PriorityTest(TestCase): | ||
|
||
@pytest.mark.timeout(300) | ||
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' |