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#3410 from kalefranz/ent-clone-fix
fix conda#3267 channels clone ent issue
- Loading branch information
Showing
7 changed files
with
213 additions
and
70 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
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,8 +1,59 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import absolute_import, division, print_function, unicode_literals | ||
|
||
from conda._vendor.auxlib.ish import dals | ||
from conda.base.context import context, reset_context | ||
from conda.common.compat import odict | ||
from conda.common.configuration import YamlRawParameter | ||
from conda.common.yaml import yaml_load | ||
from conda.models.channel import Channel | ||
from logging import getLogger | ||
from unittest import TestCase | ||
|
||
from conda.base.constants import DEFAULT_CHANNEL_ALIAS | ||
|
||
log = getLogger(__name__) | ||
|
||
platform = context.subdir | ||
|
||
|
||
class ContextTests(TestCase): | ||
|
||
def setUp(self): | ||
string = dals(""" | ||
custom_channels: | ||
darwin: https://some.url.somewhere/stuff | ||
chuck: http://another.url:8080/with/path | ||
migrated_custom_channels: | ||
darwin: s3://just/cant | ||
chuck: file:///var/lib/repo/ | ||
migrated_channel_aliases: | ||
- https://conda.anaconda.org | ||
channel_alias: ftp://new.url:8082 | ||
""") | ||
reset_context() | ||
rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_load(string))) | ||
context._add_raw_data(rd) | ||
Channel._reset_state() | ||
|
||
def tearDown(self): | ||
reset_context() | ||
|
||
def test_migrated_custom_channels(self): | ||
assert Channel('https://some.url.somewhere/stuff/noarch/a-mighty-fine.tar.bz2').canonical_name == 'darwin' | ||
assert Channel('s3://just/cant/noarch/a-mighty-fine.tar.bz2').canonical_name == 'darwin' | ||
assert Channel('s3://just/cant/noarch/a-mighty-fine.tar.bz2').urls == [ | ||
'https://some.url.somewhere/stuff/%s/' % platform, | ||
'https://some.url.somewhere/stuff/noarch/'] | ||
|
||
def test_old_channel_alias(self): | ||
cf_urls = ["ftp://new.url:8082/conda-forge/%s/" % platform, "ftp://new.url:8082/conda-forge/noarch/"] | ||
assert Channel('conda-forge').urls == cf_urls | ||
|
||
url = "https://conda.anaconda.org/conda-forge/osx-64/some-great-package.tar.bz2" | ||
assert Channel(url).canonical_name == 'conda-forge' | ||
assert Channel(url).base_url == 'ftp://new.url:8082/conda-forge' | ||
assert Channel(url).urls == cf_urls | ||
assert Channel("https://conda.anaconda.org/conda-forge/label/dev/linux-64/" | ||
"some-great-package.tar.bz2").urls == [ | ||
"ftp://new.url:8082/conda-forge/label/dev/%s/" % platform, | ||
"ftp://new.url:8082/conda-forge/label/dev/noarch/"] |
Oops, something went wrong.