예제 #1
0
    def test_link_sorting(self):
        """
        Test link sorting
        """
        links = [
            InstallationCandidate("simple", "2.0", Link(Inf)),
            InstallationCandidate("simple", "2.0", Link('simple-2.0.tar.gz')),
            InstallationCandidate(
                "simple",
                "1.0",
                Link('simple-1.0-pyT-none-TEST.whl'),
            ),
            InstallationCandidate(
                "simple",
                '1.0',
                Link('simple-1.0-pyT-TEST-any.whl'),
            ),
            InstallationCandidate(
                "simple",
                '1.0',
                Link('simple-1.0-pyT-none-any.whl'),
            ),
            InstallationCandidate(
                "simple",
                '1.0',
                Link('simple-1.0.tar.gz'),
            ),
        ]

        finder = PackageFinder([], [], session=PipSession())

        results = finder._sort_versions(links)
        results2 = finder._sort_versions(reversed(links))

        assert links == results == results2, results2
예제 #2
0
    def test_link_sorting(self):
        """
        Test link sorting
        """
        links = [
            InstallationCandidate("simple", "2.0", Link(Inf)),
            InstallationCandidate("simple", "2.0", Link('simple-2.0.tar.gz')),
            InstallationCandidate(
                "simple",
                "1.0",
                Link('simple-1.0-pyT-none-TEST.whl'),
            ),
            InstallationCandidate(
                "simple",
                '1.0',
                Link('simple-1.0-pyT-TEST-any.whl'),
            ),
            InstallationCandidate(
                "simple",
                '1.0',
                Link('simple-1.0-pyT-none-any.whl'),
            ),
            InstallationCandidate(
                "simple",
                '1.0',
                Link('simple-1.0.tar.gz'),
            ),
        ]

        finder = PackageFinder([], [], session=PipSession())

        results = finder._sort_versions(links)
        results2 = finder._sort_versions(reversed(links))

        assert links == results == results2, results2
예제 #3
0
 def test_link_sorting_raises_when_wheel_unsupported(self):
     links = [
         InstallationCandidate(
             "simple",
             '1.0',
             Link('simple-1.0-py2.py3-none-TEST.whl'),
         ),
     ]
     finder = PackageFinder([], [], session=PipSession())
     with pytest.raises(InstallationError):
         finder._sort_versions(links)
 def test_link_sorting_raises_when_wheel_unsupported(self):
     links = [
         (
             parse_version('1.0'),
             Link('simple-1.0-py2.py3-none-TEST.whl'),
             '1.0',
         ),
     ]
     finder = PackageFinder([], [], use_wheel=True, session=PipSession())
     with pytest.raises(InstallationError):
         finder._sort_versions(links)
예제 #5
0
파일: test_finder.py 프로젝트: fpytloun/pip
 def test_link_sorting_raises_when_wheel_unsupported(self):
     links = [
         (
             parse_version('1.0'),
             Link('simple-1.0-py2.py3-none-TEST.whl'),
             '1.0',
         ),
     ]
     finder = PackageFinder([], [], use_wheel=True)
     with pytest.raises(InstallationError):
         finder._sort_versions(links)
예제 #6
0
파일: test_finder.py 프로젝트: ronnix/pip
    def test_link_sorting(self):
        """
        Test link sorting
        """
        links = [
            (parse_version('2.0'), Link(Inf), '2.0'),
            (parse_version('2.0'), Link('simple-2.0.tar.gz'), '2.0'),
            (parse_version('1.0'), Link('simple-1.0-pyT-none-TEST.whl'), '1.0'),
            (parse_version('1.0'), Link('simple-1.0-pyT-TEST-any.whl'), '1.0'),
            (parse_version('1.0'), Link('simple-1.0-pyT-none-any.whl'), '1.0'),
            (parse_version('1.0'), Link('simple-1.0.tar.gz'), '1.0'),
            ]

        finder = PackageFinder([], [])
        finder.use_wheel = True

        results = finder._sort_versions(links)
        results2 = finder._sort_versions(sorted(links, reverse=True))

        assert links == results == results2, results2