Example #1
0
 def test_supported_osx_version(self):
     """
     Wheels built for macOS 10.6 are supported on 10.9
     """
     tags = pep425tags.get_supported(['27'], False)
     w = wheel.Wheel('simple-0.1-cp27-none-macosx_10_6_intel.whl')
     assert w.supported(tags=tags)
     w = wheel.Wheel('simple-0.1-cp27-none-macosx_10_9_intel.whl')
     assert w.supported(tags=tags)
Example #2
0
 def test_support_index_min(self):
     """
     Test results from `support_index_min`
     """
     tags = [
         ('py2', 'none', 'TEST'),
         ('py2', 'TEST', 'any'),
         ('py2', 'none', 'any'),
     ]
     w = wheel.Wheel('simple-0.1-py2-none-any.whl')
     assert w.support_index_min(tags=tags) == 2
     w = wheel.Wheel('simple-0.1-py2-none-TEST.whl')
     assert w.support_index_min(tags=tags) == 0
Example #3
0
 def test_wheel_pattern_multi_values(self):
     w = wheel.Wheel('simple-1.1-py2.py3-abi1.abi2-any.whl')
     assert w.name == 'simple'
     assert w.version == '1.1'
     assert w.pyversions == ['py2', 'py3']
     assert w.abis == ['abi1', 'abi2']
     assert w.plats == ['any']
Example #4
0
 def test_std_wheel_pattern(self):
     w = wheel.Wheel('simple-1.1.1-py2-none-any.whl')
     assert w.name == 'simple'
     assert w.version == '1.1.1'
     assert w.pyversions == ['py2']
     assert w.abis == ['none']
     assert w.plats == ['any']
Example #5
0
 def test_support_index_min__none_supported(self):
     """
     Test a wheel not supported by the given tags.
     """
     w = wheel.Wheel('simple-0.1-py2-none-any.whl')
     with pytest.raises(ValueError):
         w.support_index_min(tags=[])
Example #6
0
 def test_version_underscore_conversion(self):
     """
     Test that we convert '_' to '-' for versions parsed out of wheel
     filenames
     """
     w = wheel.Wheel('simple-0.1_1-py2-none-any.whl')
     assert w.version == '0.1-1'
Example #7
0
    def test_not_supported_multiarch_darwin(self):
        """
        Single-arch wheels (x86_64) are not supported on multi-arch (intel)
        """
        with patch('pip._internal.pep425tags.get_platform',
                   lambda: 'macosx_10_5_universal'):
            universal = pep425tags.get_supported(['27'], False)
        with patch('pip._internal.pep425tags.get_platform',
                   lambda: 'macosx_10_5_intel'):
            intel = pep425tags.get_supported(['27'], False)

        w = wheel.Wheel('simple-0.1-cp27-none-macosx_10_5_i386.whl')
        assert not w.supported(tags=intel)
        assert not w.supported(tags=universal)
        w = wheel.Wheel('simple-0.1-cp27-none-macosx_10_5_x86_64.whl')
        assert not w.supported(tags=intel)
        assert not w.supported(tags=universal)
Example #8
0
    def test_not_supported_multiarch_darwin(self):
        """
        Single-arch wheels (x86_64) are not supported on multi-arch (intel)
        """
        universal = pep425tags.get_supported('27',
                                             platform='macosx_10_5_universal',
                                             impl='cp')
        intel = pep425tags.get_supported('27',
                                         platform='macosx_10_5_intel',
                                         impl='cp')

        w = wheel.Wheel('simple-0.1-cp27-none-macosx_10_5_i386.whl')
        assert not w.supported(tags=intel)
        assert not w.supported(tags=universal)
        w = wheel.Wheel('simple-0.1-cp27-none-macosx_10_5_x86_64.whl')
        assert not w.supported(tags=intel)
        assert not w.supported(tags=universal)
Example #9
0
 def test_wheel_with_build_tag(self):
     # pip doesn't do anything with build tags, but theoretically, we might
     # see one, in this case the build tag = '4'
     w = wheel.Wheel('simple-1.1-4-py2-none-any.whl')
     assert w.name == 'simple'
     assert w.version == '1.1'
     assert w.pyversions == ['py2']
     assert w.abis == ['none']
     assert w.plats == ['any']
Example #10
0
 def test_not_supported_osx_version(self):
     """
     Wheels built for macOS 10.9 are not supported on 10.6
     """
     tags = pep425tags.get_supported('27',
                                     platform='macosx_10_6_intel',
                                     impl='cp')
     w = wheel.Wheel('simple-0.1-cp27-none-macosx_10_9_intel.whl')
     assert not w.supported(tags=tags)
Example #11
0
    def test_supported_multiarch_darwin(self):
        """
        Multi-arch wheels (intel) are supported on components (i386, x86_64)
        """
        with patch('pip._internal.pep425tags.get_platform',
                   lambda: 'macosx_10_5_universal'):
            universal = pep425tags.get_supported(['27'], False)
        with patch('pip._internal.pep425tags.get_platform',
                   lambda: 'macosx_10_5_intel'):
            intel = pep425tags.get_supported(['27'], False)
        with patch('pip._internal.pep425tags.get_platform',
                   lambda: 'macosx_10_5_x86_64'):
            x64 = pep425tags.get_supported(['27'], False)
        with patch('pip._internal.pep425tags.get_platform',
                   lambda: 'macosx_10_5_i386'):
            i386 = pep425tags.get_supported(['27'], False)
        with patch('pip._internal.pep425tags.get_platform',
                   lambda: 'macosx_10_5_ppc'):
            ppc = pep425tags.get_supported(['27'], False)
        with patch('pip._internal.pep425tags.get_platform',
                   lambda: 'macosx_10_5_ppc64'):
            ppc64 = pep425tags.get_supported(['27'], False)

        w = wheel.Wheel('simple-0.1-cp27-none-macosx_10_5_intel.whl')
        assert w.supported(tags=intel)
        assert w.supported(tags=x64)
        assert w.supported(tags=i386)
        assert not w.supported(tags=universal)
        assert not w.supported(tags=ppc)
        assert not w.supported(tags=ppc64)
        w = wheel.Wheel('simple-0.1-cp27-none-macosx_10_5_universal.whl')
        assert w.supported(tags=universal)
        assert w.supported(tags=intel)
        assert w.supported(tags=x64)
        assert w.supported(tags=i386)
        assert w.supported(tags=ppc)
        assert w.supported(tags=ppc64)
Example #12
0
    def test_supported_multiarch_darwin(self):
        """
        Multi-arch wheels (intel) are supported on components (i386, x86_64)
        """
        universal = pep425tags.get_supported('27',
                                             platform='macosx_10_5_universal',
                                             impl='cp')
        intel = pep425tags.get_supported('27',
                                         platform='macosx_10_5_intel',
                                         impl='cp')
        x64 = pep425tags.get_supported('27',
                                       platform='macosx_10_5_x86_64',
                                       impl='cp')
        i386 = pep425tags.get_supported('27',
                                        platform='macosx_10_5_i386',
                                        impl='cp')
        ppc = pep425tags.get_supported('27',
                                       platform='macosx_10_5_ppc',
                                       impl='cp')
        ppc64 = pep425tags.get_supported('27',
                                         platform='macosx_10_5_ppc64',
                                         impl='cp')

        w = wheel.Wheel('simple-0.1-cp27-none-macosx_10_5_intel.whl')
        assert w.supported(tags=intel)
        assert w.supported(tags=x64)
        assert w.supported(tags=i386)
        assert not w.supported(tags=universal)
        assert not w.supported(tags=ppc)
        assert not w.supported(tags=ppc64)
        w = wheel.Wheel('simple-0.1-cp27-none-macosx_10_5_universal.whl')
        assert w.supported(tags=universal)
        assert w.supported(tags=intel)
        assert w.supported(tags=x64)
        assert w.supported(tags=i386)
        assert w.supported(tags=ppc)
        assert w.supported(tags=ppc64)
Example #13
0
 def test_invalid_filename_raises(self):
     with pytest.raises(InvalidWheelFilename):
         wheel.Wheel('invalid.whl')
Example #14
0
 def test_support_index_min_none(self):
     """
     Test `support_index_min` returns None, when wheel not supported
     """
     w = wheel.Wheel('simple-0.1-py2-none-any.whl')
     assert w.support_index_min(tags=[]) is None
Example #15
0
 def test_single_digit_version(self):
     w = wheel.Wheel('simple-1-py2-none-any.whl')
     assert w.version == '1'
Example #16
0
 def test_non_pep440_version(self):
     w = wheel.Wheel('simple-_invalid_-py2-none-any.whl')
     assert w.version == '-invalid-'
Example #17
0
 def test_missing_version_raises(self):
     with pytest.raises(InvalidWheelFilename):
         wheel.Wheel('Cython-cp27-none-linux_x86_64.whl')
Example #18
0
 def test_not_supported_version(self):
     """
     Test unsupported wheel is known to be unsupported
     """
     w = wheel.Wheel('simple-0.1-py2-none-any.whl')
     assert not w.supported(tags=[('py1', 'none', 'any')])
Example #19
0
 def test_supported_multi_version(self):
     """
     Test multi-version wheel is known to be supported
     """
     w = wheel.Wheel('simple-0.1-py2.py3-none-any.whl')
     assert w.supported(tags=[('py3', 'none', 'any')])
Example #20
0
 def test_supported_single_version(self):
     """
     Test single-version wheel is known to be supported
     """
     w = wheel.Wheel('simple-0.1-py2-none-any.whl')
     assert w.supported(tags=[('py2', 'none', 'any')])