Esempio n. 1
0
 def test_prefix_record_no_channel(self):
     with env_unmodified(conda_tests_ctxt_mgmt_def_pol):
         pr = PrefixRecord(
             name='austin',
             version='1.2.3',
             build_string='py34_2',
             build_number=2,
             url="https://repo.anaconda.com/pkgs/main/win-32/austin-1.2.3-py34_2.tar.bz2",
             subdir="win-32",
             md5='0123456789',
             files=(),
         )
         assert pr.url == "https://repo.anaconda.com/pkgs/main/win-32/austin-1.2.3-py34_2.tar.bz2"
         assert pr.channel.canonical_name == 'defaults'
         assert pr.subdir == "win-32"
         assert pr.fn == "austin-1.2.3-py34_2.tar.bz2"
         channel_str = text_type(Channel("https://repo.anaconda.com/pkgs/main/win-32/austin-1.2.3-py34_2.tar.bz2"))
         assert channel_str == "https://repo.anaconda.com/pkgs/main/win-32"
         assert dict(pr.dump()) == dict(
             name='austin',
             version='1.2.3',
             build='py34_2',
             build_number=2,
             url="https://repo.anaconda.com/pkgs/main/win-32/austin-1.2.3-py34_2.tar.bz2",
             md5='0123456789',
             files=(),
             channel=channel_str,
             subdir="win-32",
             fn="austin-1.2.3-py34_2.tar.bz2",
             constrains=(),
             depends=(),
         )
Esempio n. 2
0
    def test_parse_spec_str_tarball_url(self):
        with env_unmodified(conda_tests_ctxt_mgmt_def_pol):
            url = "https://repo.anaconda.com/pkgs/main/linux-64/_license-1.1-py27_1.tar.bz2"
            assert _parse_spec_str(url) == {
                "channel": "defaults",
                "subdir": "linux-64",
                "name": "_license",
                "version": "1.1",
                "build": "py27_1",
                "fn": "_license-1.1-py27_1.tar.bz2",
                "url": url,
            }

            url = "https://conda.anaconda.org/conda-canary/linux-64/conda-4.3.21.post699+1dab973-py36h4a561cd_0.tar.bz2"
            assert _parse_spec_str(url) == {
                "channel": "conda-canary",
                "subdir": "linux-64",
                "name": "conda",
                "version": "4.3.21.post699+1dab973",
                "build": "py36h4a561cd_0",
                "fn": "conda-4.3.21.post699+1dab973-py36h4a561cd_0.tar.bz2",
                "url": url,
            }

            url = "https://conda.anaconda.org/conda-canary/linux-64/conda-4.3.21.post699+1dab973-py36h4a561cd_0.conda"
            assert _parse_spec_str(url) == {
                "channel": "conda-canary",
                "subdir": "linux-64",
                "name": "conda",
                "version": "4.3.21.post699+1dab973",
                "build": "py36h4a561cd_0",
                "fn": "conda-4.3.21.post699+1dab973-py36h4a561cd_0.conda",
                "url": url,
            }
Esempio n. 3
0
    def test_parse_spec_str_tarball_url(self):
        with env_unmodified(conda_tests_ctxt_mgmt_def_pol):
            url = "https://repo.anaconda.com/pkgs/main/linux-64/_license-1.1-py27_1.tar.bz2"
            assert _parse_spec_str(url) == {
                "channel": "defaults",
                "subdir": "linux-64",
                "name": "_license",
                "version": "1.1",
                "build": "py27_1",
                "fn": "_license-1.1-py27_1.tar.bz2",
                "url": url,
            }

            url = "https://conda.anaconda.org/conda-canary/linux-64/conda-4.3.21.post699+1dab973-py36h4a561cd_0.tar.bz2"
            assert _parse_spec_str(url) == {
                "channel": "conda-canary",
                "subdir": "linux-64",
                "name": "conda",
                "version": "4.3.21.post699+1dab973",
                "build": "py36h4a561cd_0",
                "fn": "conda-4.3.21.post699+1dab973-py36h4a561cd_0.tar.bz2",
                "url": url,
            }

            url = "https://conda.anaconda.org/conda-canary/linux-64/conda-4.3.21.post699+1dab973-py36h4a561cd_0.conda"
            assert _parse_spec_str(url) == {
                "channel": "conda-canary",
                "subdir": "linux-64",
                "name": "conda",
                "version": "4.3.21.post699+1dab973",
                "build": "py36h4a561cd_0",
                "fn": "conda-4.3.21.post699+1dab973-py36h4a561cd_0.conda",
                "url": url,
            }
Esempio n. 4
0
    def test_default_channel(self):
        with env_unmodified(conda_tests_ctxt_mgmt_def_pol):
            dc = Channel('defaults')
            assert dc.canonical_name == 'defaults'
            assert dc.urls() == self.DEFAULT_URLS
            assert dc.subdir is None
            assert text_type(dc) == 'defaults'

            dc = Channel('defaults/win-32')
            assert dc.canonical_name == 'defaults'
            assert dc.subdir == 'win-32'
            assert dc.urls()[0] == 'https://repo.anaconda.com/pkgs/main/win-32'
            assert dc.urls()[1] == 'https://repo.anaconda.com/pkgs/main/noarch'
            assert dc.urls()[2].endswith('/win-32')
Esempio n. 5
0
    def test_default_channel(self):
        with env_unmodified(conda_tests_ctxt_mgmt_def_pol):
            dc = Channel('defaults')
            assert dc.canonical_name == 'defaults'
            assert dc.urls() == self.DEFAULT_URLS
            assert dc.subdir is None
            assert text_type(dc) == 'defaults'

            dc = Channel('defaults/win-32')
            assert dc.canonical_name == 'defaults'
            assert dc.subdir == 'win-32'
            assert dc.urls()[0] == 'https://repo.anaconda.com/pkgs/main/win-32'
            assert dc.urls()[1] == 'https://repo.anaconda.com/pkgs/main/noarch'
            assert dc.urls()[2].endswith('/win-32')
Esempio n. 6
0
    def test_channel_matching(self):
        with env_unmodified(conda_tests_ctxt_mgmt_def_pol):
            assert ChannelMatch('pkgs/main').match('defaults') is False
            assert ChannelMatch('defaults').match('pkgs/main') is True

            assert ChannelMatch("https://repo.anaconda.com/pkgs/main").match('defaults') is False
            assert ChannelMatch("defaults").match("https://repo.anaconda.com/pkgs/main") is True

            assert ChannelMatch("https://conda.anaconda.org/conda-forge").match('conda-forge') is True
            assert ChannelMatch("conda-forge").match("https://conda.anaconda.org/conda-forge") is True

            assert ChannelMatch("https://repo.anaconda.com/pkgs/main").match('conda-forge') is False

            assert str(MatchSpec("pkgs/main::*")) == "pkgs/main::*"
            assert str(MatchSpec("defaults::*")) == "defaults::*"
Esempio n. 7
0
    def test_channel_matching(self):
        with env_unmodified(conda_tests_ctxt_mgmt_def_pol):
            assert ChannelMatch('pkgs/main').match('defaults') is False
            assert ChannelMatch('defaults').match('pkgs/main') is True

            assert ChannelMatch("https://repo.anaconda.com/pkgs/main").match('defaults') is False
            assert ChannelMatch("defaults").match("https://repo.anaconda.com/pkgs/main") is True

            assert ChannelMatch("https://conda.anaconda.org/conda-forge").match('conda-forge') is True
            assert ChannelMatch("conda-forge").match("https://conda.anaconda.org/conda-forge") is True

            assert ChannelMatch("https://repo.anaconda.com/pkgs/main").match('conda-forge') is False

            assert str(MatchSpec("pkgs/main::*")) == "pkgs/main::*"
            assert str(MatchSpec("defaults::*")) == "defaults::*"
Esempio n. 8
0
    def test_channel_name_subdir_only(self):
        with env_unmodified(conda_tests_ctxt_mgmt_def_pol):
            channel = Channel('pkgs/main/win-64')
            assert channel.scheme == "https"
            assert channel.location == "repo.anaconda.com"
            assert channel.platform == 'win-64' == channel.subdir
            assert channel.name == 'pkgs/main'

            assert channel.base_url == 'https://repo.anaconda.com/pkgs/main'
            assert channel.canonical_name == 'defaults'
            assert channel.url() == 'https://repo.anaconda.com/pkgs/main/win-64'
            assert channel.urls() == [
                'https://repo.anaconda.com/pkgs/main/win-64',
                'https://repo.anaconda.com/pkgs/main/noarch',
            ]
Esempio n. 9
0
    def test_channel_name_subdir_only(self):
        with env_unmodified(conda_tests_ctxt_mgmt_def_pol):
            channel = Channel('pkgs/free/win-64')
            assert channel.scheme == "https"
            assert channel.location == "repo.anaconda.com"
            assert channel.platform == 'win-64' == channel.subdir
            assert channel.name == 'pkgs/free'

            assert channel.base_url == 'https://repo.anaconda.com/pkgs/free'
            assert channel.canonical_name == 'defaults'
            assert channel.url() == 'https://repo.anaconda.com/pkgs/free/win-64'
            assert channel.urls() == [
                'https://repo.anaconda.com/pkgs/free/win-64',
                'https://repo.anaconda.com/pkgs/free/noarch',
            ]
Esempio n. 10
0
def test_multichannel_priority():
    with env_unmodified(conda_tests_ctxt_mgmt_def_pol):
        channels = ['conda-test', 'defaults', 'conda-forge']
        subdirs = ['new-optimized-subdir', 'linux-32', 'noarch']
        channel_priority_map = prioritize_channels(channels, with_credentials=True, subdirs=subdirs)
        if on_win:
            assert channel_priority_map == OrderedDict([
                ('https://conda.anaconda.org/conda-test/new-optimized-subdir', ('conda-test', 0)),
                ('https://conda.anaconda.org/conda-test/linux-32', ('conda-test', 0)),
                ('https://conda.anaconda.org/conda-test/noarch', ('conda-test', 0)),
                ('https://repo.anaconda.com/pkgs/main/new-optimized-subdir', ('defaults', 1)),
                ('https://repo.anaconda.com/pkgs/main/linux-32', ('defaults', 1)),
                ('https://repo.anaconda.com/pkgs/main/noarch', ('defaults', 1)),
                ('https://repo.anaconda.com/pkgs/free/new-optimized-subdir', ('defaults', 2)),
                ('https://repo.anaconda.com/pkgs/free/linux-32', ('defaults', 2)),
                ('https://repo.anaconda.com/pkgs/free/noarch', ('defaults', 2)),
                ('https://repo.anaconda.com/pkgs/r/new-optimized-subdir', ('defaults', 3)),
                ('https://repo.anaconda.com/pkgs/r/linux-32', ('defaults', 3)),
                ('https://repo.anaconda.com/pkgs/r/noarch', ('defaults', 3)),
                ('https://repo.anaconda.com/pkgs/msys2/new-optimized-subdir', ('defaults', 4)),
                ('https://repo.anaconda.com/pkgs/msys2/linux-32', ('defaults', 4)),
                ('https://repo.anaconda.com/pkgs/msys2/noarch', ('defaults', 4)),
                ('https://conda.anaconda.org/conda-forge/new-optimized-subdir', ('conda-forge', 5)),
                ('https://conda.anaconda.org/conda-forge/linux-32', ('conda-forge', 5)),
                ('https://conda.anaconda.org/conda-forge/noarch', ('conda-forge', 5)),
            ])
        else:
            assert channel_priority_map == OrderedDict([
                ('https://conda.anaconda.org/conda-test/new-optimized-subdir', ('conda-test', 0)),
                ('https://conda.anaconda.org/conda-test/linux-32', ('conda-test', 0)),
                ('https://conda.anaconda.org/conda-test/noarch', ('conda-test', 0)),
                ('https://repo.anaconda.com/pkgs/main/new-optimized-subdir', ('defaults', 1)),
                ('https://repo.anaconda.com/pkgs/main/linux-32', ('defaults', 1)),
                ('https://repo.anaconda.com/pkgs/main/noarch', ('defaults', 1)),
                ('https://repo.anaconda.com/pkgs/free/new-optimized-subdir', ('defaults', 2)),
                ('https://repo.anaconda.com/pkgs/free/linux-32', ('defaults', 2)),
                ('https://repo.anaconda.com/pkgs/free/noarch', ('defaults', 2)),
                ('https://repo.anaconda.com/pkgs/r/new-optimized-subdir', ('defaults', 3)),
                ('https://repo.anaconda.com/pkgs/r/linux-32', ('defaults', 3)),
                ('https://repo.anaconda.com/pkgs/r/noarch', ('defaults', 3)),
                ('https://conda.anaconda.org/conda-forge/new-optimized-subdir', ('conda-forge', 4)),
                ('https://conda.anaconda.org/conda-forge/linux-32', ('conda-forge', 4)),
                ('https://conda.anaconda.org/conda-forge/noarch', ('conda-forge', 4)),
            ])
Esempio n. 11
0
    def test_dist(self):
        with env_unmodified(conda_tests_ctxt_mgmt_def_pol):
            dst = Dist('defaults::foo-1.2.3-4.tar.bz2')
            a = MatchSpec(dst)
            b = MatchSpec(a)
            c = MatchSpec(dst, optional=True, target='burg')
            d = MatchSpec(a, build='5')

            assert a == b
            assert hash(a) == hash(b)
            assert a is b

            assert a != c
            assert hash(a) != hash(c)

            assert a != d
            assert hash(a) != hash(d)

            p = MatchSpec(channel='defaults',name='python',version=VersionSpec('3.5*'))
            assert p.match(Dist(channel='defaults', dist_name='python-3.5.3-1', name='python',
                                version='3.5.3', build_string='1', build_number=1, base_url=None,
                                platform=None))

            assert not p.match(Dist(channel='defaults', dist_name='python-3.6.0-0', name='python',
                                    version='3.6.0', build_string='0', build_number=0, base_url=None,
                                    platform=None))

            assert p.match(Dist(channel='defaults', dist_name='python-3.5.1-0', name='python',
                                version='3.5.1', build_string='0', build_number=0, base_url=None,
                                platform=None))
            assert p.match(PackageRecord(name='python', version='3.5.1', build='0', build_number=0,
                                         depends=('openssl 1.0.2*', 'readline 6.2*', 'sqlite',
                                                   'tk 8.5*', 'xz 5.0.5', 'zlib 1.2*', 'pip'),
                                         channel=Channel(scheme='https', auth=None,
                                                          location='repo.anaconda.com', token=None,
                                                          name='pkgs/main', platform='osx-64',
                                                          package_filename=None),
                                         subdir='osx-64', fn='python-3.5.1-0.tar.bz2',
                                         md5='a813bc0a32691ab3331ac9f37125164c', size=14678857,
                                         priority=0,
                                         url='https://repo.anaconda.com/pkgs/main/osx-64/python-3.5.1-0.tar.bz2'))
Esempio n. 12
0
    def test_dist(self):
        with env_unmodified(conda_tests_ctxt_mgmt_def_pol):
            dst = Dist('defaults::foo-1.2.3-4.tar.bz2')
            a = MatchSpec(dst)
            b = MatchSpec(a)
            c = MatchSpec(dst, optional=True, target='burg')
            d = MatchSpec(a, build='5')

            assert a == b
            assert hash(a) == hash(b)
            assert a is b

            assert a != c
            assert hash(a) != hash(c)

            assert a != d
            assert hash(a) != hash(d)

            p = MatchSpec(channel='defaults',name='python',version=VersionSpec('3.5*'))
            assert p.match(Dist(channel='defaults', dist_name='python-3.5.3-1', name='python',
                                version='3.5.3', build_string='1', build_number=1, base_url=None,
                                platform=None))

            assert not p.match(Dist(channel='defaults', dist_name='python-3.6.0-0', name='python',
                                    version='3.6.0', build_string='0', build_number=0, base_url=None,
                                    platform=None))

            assert p.match(Dist(channel='defaults', dist_name='python-3.5.1-0', name='python',
                                version='3.5.1', build_string='0', build_number=0, base_url=None,
                                platform=None))
            assert p.match(PackageRecord(name='python', version='3.5.1', build='0', build_number=0,
                                         depends=('openssl 1.0.2*', 'readline 6.2*', 'sqlite',
                                                   'tk 8.5*', 'xz 5.0.5', 'zlib 1.2*', 'pip'),
                                         channel=Channel(scheme='https', auth=None,
                                                          location='repo.anaconda.com', token=None,
                                                          name='pkgs/main', platform='osx-64',
                                                          package_filename=None),
                                         subdir='osx-64', fn='python-3.5.1-0.tar.bz2',
                                         md5='a813bc0a32691ab3331ac9f37125164c', size=14678857,
                                         priority=0,
                                         url='https://repo.anaconda.com/pkgs/main/osx-64/python-3.5.1-0.tar.bz2'))