Skip to content

Commit

Permalink
finish tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kalefranz committed Sep 13, 2016
1 parent 023bf0f commit 655d213
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ clean:
find . -name \*.py[cod] -delete
find . -name __pycache__ -delete
rm -rf *.egg-info* .cache build
rm -f .coverage junit.xml tmpfile.rc conda/.version
rm -f .coverage junit.xml tmpfile.rc conda/.version tempfile.rc coverage.xml
rm -rf auxlib bin conda/progressbar
rm -rf conda-forge\:\: file\: https\: local\:\: r\:\:


clean-all: clean
Expand Down
2 changes: 1 addition & 1 deletion conda/models/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def __init__(self, name):
parsed = urlparse(context.channel_alias)
self._scheme = parsed.scheme
self._netloc = parsed.netloc
self._path = join(parsed.path, name)
self._path = join(parsed.path or '/', name)
self._platform = None

def __repr__(self):
Expand Down
27 changes: 21 additions & 6 deletions tests/base/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,47 @@

log = getLogger(__name__)

platform = context.subdir


class ContextTests(TestCase):

def test_old_custom_channels(self):
def setUp(self):
string = dals("""
custom_channels:
darwin: https://some.url.somewhere/stuff
chuck: http://another.url:8080/with/path
old_custom_channels:
darwin: s3://just/cant
chuck: file:///var/lib/repo/
old_channel_alias: https://conda.anaconda.org
old_channel_aliases:
- https://conda.anaconda.org
channel_alias: ftp://new.url:8082
""")
platform = context.subdir
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_old_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):
assert False


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/"]

0 comments on commit 655d213

Please sign in to comment.