示例#1
0
    def test_parse_build_number_brackets(self):
        assert _parse_spec_str("python[build_number=3]") == {
            "_original_spec_str": "python[build_number=3]",
            "name": "python",
            "build_number": '3',
        }
        assert _parse_spec_str("python[build_number='>3']") == {
            "_original_spec_str": "python[build_number='>3']",
            "name": "python",
            "build_number": '>3',
        }
        assert _parse_spec_str("python[build_number='>=3']") == {
            "_original_spec_str": "python[build_number='>=3']",
            "name": "python",
            "build_number": '>=3',
        }

        assert _parse_spec_str("python[build_number='<3']") == {
            "_original_spec_str": "python[build_number='<3']",
            "name": "python",
            "build_number": '<3',
        }
        assert _parse_spec_str("python[build_number='<=3']") == {
            "_original_spec_str": "python[build_number='<=3']",
            "name": "python",
            "build_number": '<=3',
        }
示例#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,
            }
示例#3
0
 def test_parse_spec_str_with_brackets(self):
     assert _parse_spec_str("defaults::numpy[channel=anaconda]") == {
         "_original_spec_str": "defaults::numpy[channel=anaconda]",
         "channel": "anaconda",
         "name": "numpy",
     }
     assert _parse_spec_str(
         "defaults::numpy 1.8 py27_0[channel=anaconda]") == {
             "_original_spec_str":
             "defaults::numpy 1.8 py27_0[channel=anaconda]",
             "channel": "anaconda",
             "name": "numpy",
             "version": "1.8",
             "build": "py27_0",
         }
     assert _parse_spec_str(
         "defaults::numpy=1.8=py27_0 [channel=anaconda,version=1.9, build=3]"
     ) == {
         "_original_spec_str":
         "defaults::numpy=1.8=py27_0 [channel=anaconda,version=1.9, build=3]",
         "channel": "anaconda",
         "name": "numpy",
         "version": "1.9",
         "build": "3",
     }
     assert _parse_spec_str(
         'defaults::numpy=1.8=py27_0 [channel=\'anaconda\',version=">=1.8,<2|1.9", build=\'3\']'
     ) == {
         "_original_spec_str":
         'defaults::numpy=1.8=py27_0 [channel=\'anaconda\',version=">=1.8,<2|1.9", build=\'3\']',
         "channel": "anaconda",
         "name": "numpy",
         "version": ">=1.8,<2|1.9",
         "build": "3",
     }
示例#4
0
 def test_parse_equal_equal(self):
     assert _parse_spec_str("numpy==1.7") == {
         "_original_spec_str": "numpy==1.7",
         "name": "numpy",
         "version": "1.7",
     }
     assert _parse_spec_str("numpy ==1.7") == {
         "_original_spec_str": "numpy ==1.7",
         "name": "numpy",
         "version": "1.7",
     }
     assert _parse_spec_str("numpy=1.7") == {
         "_original_spec_str": "numpy=1.7",
         "name": "numpy",
         "version": "1.7*",
     }
     assert _parse_spec_str("numpy =1.7") == {
         "_original_spec_str": "numpy =1.7",
         "name": "numpy",
         "version": "1.7*",
     }
     assert _parse_spec_str("numpy !=1.7") == {
         "_original_spec_str": "numpy !=1.7",
         "name": "numpy",
         "version": "!=1.7",
     }
示例#5
0
    def test_parse_build_number_brackets(self):
        assert _parse_spec_str("python[build_number=3]") == {
            "_original_spec_str": "python[build_number=3]",
            "name": "python",
            "build_number": '3',
        }
        assert _parse_spec_str("python[build_number='>3']") == {
            "_original_spec_str": "python[build_number='>3']",
            "name": "python",
            "build_number": '>3',
        }
        assert _parse_spec_str("python[build_number='>=3']") == {
            "_original_spec_str": "python[build_number='>=3']",
            "name": "python",
            "build_number": '>=3',
        }

        assert _parse_spec_str("python[build_number='<3']") == {
            "_original_spec_str": "python[build_number='<3']",
            "name": "python",
            "build_number": '<3',
        }
        assert _parse_spec_str("python[build_number='<=3']") == {
            "_original_spec_str": "python[build_number='<=3']",
            "name": "python",
            "build_number": '<=3',
        }
示例#6
0
 def test_parse_equal_equal(self):
     assert _parse_spec_str("numpy==1.7") == {
         "_original_spec_str": "numpy==1.7",
         "name": "numpy",
         "version": "1.7",
     }
     assert _parse_spec_str("numpy ==1.7") == {
         "_original_spec_str": "numpy ==1.7",
         "name": "numpy",
         "version": "1.7",
     }
     assert _parse_spec_str("numpy=1.7") == {
         "_original_spec_str": "numpy=1.7",
         "name": "numpy",
         "version": "1.7*",
     }
     assert _parse_spec_str("numpy =1.7") == {
         "_original_spec_str": "numpy =1.7",
         "name": "numpy",
         "version": "1.7*",
     }
     assert _parse_spec_str("numpy !=1.7") == {
         "_original_spec_str": "numpy !=1.7",
         "name": "numpy",
         "version": "!=1.7",
     }
示例#7
0
 def test_parse_spec_str_with_brackets(self):
     assert _parse_spec_str("defaults::numpy[channel=anaconda]") == {
         "_original_spec_str": "defaults::numpy[channel=anaconda]",
         "channel": "anaconda",
         "name": "numpy",
     }
     assert _parse_spec_str("defaults::numpy 1.8 py27_0[channel=anaconda]") == {
         "_original_spec_str": "defaults::numpy 1.8 py27_0[channel=anaconda]",
         "channel": "anaconda",
         "name": "numpy",
         "version": "1.8",
         "build": "py27_0",
     }
     assert _parse_spec_str("defaults::numpy=1.8=py27_0 [channel=anaconda,version=1.9, build=3]") == {
         "_original_spec_str": "defaults::numpy=1.8=py27_0 [channel=anaconda,version=1.9, build=3]",
         "channel": "anaconda",
         "name": "numpy",
         "version": "1.9",
         "build": "3",
     }
     assert _parse_spec_str('defaults::numpy=1.8=py27_0 [channel=\'anaconda\',version=">=1.8,<2|1.9", build=\'3\']') == {
         "_original_spec_str": 'defaults::numpy=1.8=py27_0 [channel=\'anaconda\',version=">=1.8,<2|1.9", build=\'3\']',
         "channel": "anaconda",
         "name": "numpy",
         "version": ">=1.8,<2|1.9",
         "build": "3",
     }
示例#8
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,
            }
示例#9
0
 def test_parse_equal_equal(self):
     assert _parse_spec_str("numpy==1.7") == {
         "name": "numpy",
         "version": "1.7",
     }
     assert _parse_spec_str("numpy ==1.7") == {
         "name": "numpy",
         "version": "1.7",
     }
示例#10
0
 def test_star_name(self):
     assert _parse_spec_str("* 2.7.4") == {
         "name": "*",
         "version": "2.7.4",
     }
     assert _parse_spec_str("* >=1.3 2") == {
         "name": "*",
         "version": ">=1.3",
         "build": "2",
     }
示例#11
0
 def test_parse_parens(self):
     assert _parse_spec_str("conda-forge::foo[build=3](target=blarg,optional)") == {
         "channel": "conda-forge",
         "name": "foo",
         "build": "3",
         # "target": "blarg",  # suppressing these for now
         # "optional": True,
     }
示例#12
0
    def test_parse_hard(self):
        assert _parse_spec_str("numpy~=1.7.1") == {
            "_original_spec_str": "numpy~=1.7.1",
            "name": "numpy",
            "version": "~=1.7.1",
        }
        assert _parse_spec_str("numpy>1.8,<2|==1.7") == {
            "_original_spec_str": "numpy>1.8,<2|==1.7",
            "name": "numpy",
            "version": ">1.8,<2|==1.7",
        }
        assert _parse_spec_str("numpy >1.8,<2|==1.7,!=1.9,~=1.7.1 py34_0") == {
            "_original_spec_str": "numpy >1.8,<2|==1.7,!=1.9,~=1.7.1 py34_0",
            "name": "numpy",
            "version": ">1.8,<2|==1.7,!=1.9,~=1.7.1",
            "build": "py34_0",
        }
        assert _parse_spec_str("*>1.8,<2|==1.7") == {
            "_original_spec_str": "*>1.8,<2|==1.7",
            "name": "*",
            "version": ">1.8,<2|==1.7",
        }
        assert _parse_spec_str("* >1.8,<2|==1.7") == {
            "_original_spec_str": "* >1.8,<2|==1.7",
            "name": "*",
            "version": ">1.8,<2|==1.7",
        }

        assert _parse_spec_str("* 1 *") == {
            "_original_spec_str": "* 1 *",
            "name": "*",
            "version": "1",
            "build": "*",
        }
        assert _parse_spec_str("* * openblas_0") == {
            "_original_spec_str": "* * openblas_0",
            "name": "*",
            "version": "*",
            "build": "openblas_0",
        }
        assert _parse_spec_str("* * *") == {
            "_original_spec_str": "* * *",
            "name": "*",
            "version": "*",
            "build": "*",
        }
        assert _parse_spec_str("* *") == {
            "_original_spec_str": "* *",
            "name": "*",
            "version": "*",
        }
示例#13
0
    def test_parse_hard(self):
        assert _parse_spec_str("numpy~=1.7.1") == {
            "_original_spec_str": "numpy~=1.7.1",
            "name": "numpy",
            "version": "~=1.7.1",
        }
        assert _parse_spec_str("numpy>1.8,<2|==1.7") == {
            "_original_spec_str": "numpy>1.8,<2|==1.7",
            "name": "numpy",
            "version": ">1.8,<2|==1.7",
        }
        assert _parse_spec_str("numpy >1.8,<2|==1.7,!=1.9,~=1.7.1 py34_0") == {
            "_original_spec_str": "numpy >1.8,<2|==1.7,!=1.9,~=1.7.1 py34_0",
            "name": "numpy",
            "version": ">1.8,<2|==1.7,!=1.9,~=1.7.1",
            "build": "py34_0",
        }
        assert _parse_spec_str("*>1.8,<2|==1.7") == {
            "_original_spec_str": "*>1.8,<2|==1.7",
            "name": "*",
            "version": ">1.8,<2|==1.7",
        }
        assert _parse_spec_str("* >1.8,<2|==1.7") == {
            "_original_spec_str": "* >1.8,<2|==1.7",
            "name": "*",
            "version": ">1.8,<2|==1.7",
        }

        assert _parse_spec_str("* 1 *") == {
            "_original_spec_str": "* 1 *",
            "name": "*",
            "version": "1",
            "build": "*",
        }
        assert _parse_spec_str("* * openblas_0") == {
            "_original_spec_str": "* * openblas_0",
            "name": "*",
            "version": "*",
            "build": "openblas_0",
        }
        assert _parse_spec_str("* * *") == {
            "_original_spec_str": "* * *",
            "name": "*",
            "version": "*",
            "build": "*",
        }
        assert _parse_spec_str("* *") == {
            "_original_spec_str": "* *",
            "name": "*",
            "version": "*",
        }
示例#14
0
    def test_parse_channel_subdir(self):
        assert _parse_spec_str("conda-forge::foo>=1.0") == {
            "channel": "conda-forge",
            "name": "foo",
            "version": ">=1.0",
        }

        assert _parse_spec_str("conda-forge/linux-32::foo>=1.0") == {
            "channel": "conda-forge",
            "subdir": "linux-32",
            "name": "foo",
            "version": ">=1.0",
        }

        assert _parse_spec_str("*/linux-32::foo>=1.0") == {
            "channel": "*",
            "subdir": "linux-32",
            "name": "foo",
            "version": ">=1.0",
        }
示例#15
0
    def test_parse_spec_str_tarball_url(self):
        url = "https://repo.continuum.io/pkgs/free/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,
        }
示例#16
0
 def test_parse_spec_str_no_brackets(self):
     assert _parse_spec_str("numpy") == {
         "_original_spec_str": "numpy",
         "name": "numpy",
     }
     assert _parse_spec_str("defaults::numpy") == {
         "_original_spec_str": "defaults::numpy",
         "channel": "defaults",
         "name": "numpy",
     }
     assert _parse_spec_str(
         "https://repo.anaconda.com/pkgs/free::numpy") == {
             "_original_spec_str":
             "https://repo.anaconda.com/pkgs/free::numpy",
             "channel": "pkgs/free",
             "name": "numpy",
         }
     assert _parse_spec_str("defaults::numpy=1.8") == {
         "_original_spec_str": "defaults::numpy=1.8",
         "channel": "defaults",
         "name": "numpy",
         "version": "1.8*",
     }
     assert _parse_spec_str("defaults::numpy =1.8") == {
         "_original_spec_str": "defaults::numpy =1.8",
         "channel": "defaults",
         "name": "numpy",
         "version": "1.8*",
     }
     assert _parse_spec_str("defaults::numpy=1.8=py27_0") == {
         "_original_spec_str": "defaults::numpy=1.8=py27_0",
         "channel": "defaults",
         "name": "numpy",
         "version": "1.8",
         "build": "py27_0",
     }
     assert _parse_spec_str("defaults::numpy 1.8 py27_0") == {
         "_original_spec_str": "defaults::numpy 1.8 py27_0",
         "channel": "defaults",
         "name": "numpy",
         "version": "1.8",
         "build": "py27_0",
     }
示例#17
0
    def test_parse_hard(self):
        assert _parse_spec_str("numpy>1.8,<2|==1.7") == {
            "name": "numpy",
            "version": ">1.8,<2|==1.7",
        }
        assert _parse_spec_str("numpy >1.8,<2|==1.7") == {
            "name": "numpy",
            "version": ">1.8,<2|==1.7",
        }
        assert _parse_spec_str("*>1.8,<2|==1.7") == {
            "name": "*",
            "version": ">1.8,<2|==1.7",
        }
        assert _parse_spec_str("* >1.8,<2|==1.7") == {
            "name": "*",
            "version": ">1.8,<2|==1.7",
        }

        assert _parse_spec_str("* 1 *") == {
            "name": "*",
            "version": "1",
            "build": "*",
        }
        assert _parse_spec_str("* * openblas_0") == {
            "name": "*",
            "version": "*",
            "build": "openblas_0",
        }
        assert _parse_spec_str("* * *") == {
            "name": "*",
            "version": "*",
            "build": "*",
        }
        assert _parse_spec_str("* *") == {
            "name": "*",
            "version": "*",
        }
示例#18
0
 def test_parse_spec_str_no_brackets(self):
     assert _parse_spec_str("numpy") == {
         "_original_spec_str": "numpy",
         "name": "numpy",
     }
     assert _parse_spec_str("defaults::numpy") == {
         "_original_spec_str": "defaults::numpy",
         "channel": "defaults",
         "name": "numpy",
     }
     assert _parse_spec_str("https://repo.anaconda.com/pkgs/free::numpy") == {
         "_original_spec_str": "https://repo.anaconda.com/pkgs/free::numpy",
         "channel": "pkgs/free",
         "name": "numpy",
     }
     assert _parse_spec_str("defaults::numpy=1.8") == {
         "_original_spec_str": "defaults::numpy=1.8",
         "channel": "defaults",
         "name": "numpy",
         "version": "1.8*",
     }
     assert _parse_spec_str("defaults::numpy =1.8") == {
         "_original_spec_str": "defaults::numpy =1.8",
         "channel": "defaults",
         "name": "numpy",
         "version": "1.8*",
     }
     assert _parse_spec_str("defaults::numpy=1.8=py27_0") == {
         "_original_spec_str": "defaults::numpy=1.8=py27_0",
         "channel": "defaults",
         "name": "numpy",
         "version": "1.8",
         "build": "py27_0",
     }
     assert _parse_spec_str("defaults::numpy 1.8 py27_0") == {
         "_original_spec_str": "defaults::numpy 1.8 py27_0",
         "channel": "defaults",
         "name": "numpy",
         "version": "1.8",
         "build": "py27_0",
     }
示例#19
0
 def test_parse_spec_str_no_brackets(self):
     assert _parse_spec_str("numpy") == {
         "name": "numpy",
     }
     assert _parse_spec_str("defaults::numpy") == {
         "channel": "defaults",
         "name": "numpy",
     }
     assert _parse_spec_str("https://repo.continuum.io/pkgs/free::numpy") == {
         "channel": "defaults",
         "name": "numpy",
     }
     assert _parse_spec_str("defaults::numpy=1.8") == {
         "channel": "defaults",
         "name": "numpy",
         "version": "1.8*",
     } == _parse_spec_str("defaults::numpy =1.8")
     assert _parse_spec_str("defaults::numpy=1.8=py27_0") == {
         "channel": "defaults",
         "name": "numpy",
         "version": "1.8",
         "build": "py27_0",
     } == _parse_spec_str("defaults::numpy 1.8 py27_0")
示例#20
0
 def test_parse_errors(self):
     with pytest.raises(InvalidMatchSpec):
         _parse_spec_str('!xyz 1.3')
示例#21
0
 def test_parse_errors(self):
     with pytest.raises(InvalidMatchSpec):
         _parse_spec_str('!xyz 1.3')
示例#22
0
 def test_parse_errors(self):
     with pytest.raises(CondaValueError):
         _parse_spec_str('!xyz 1.3')