Exemple #1
0
 def test_filter_platform_wrong_pyver(self):
     name = 'myext'
     # Should raise as not py2.py3
     with IndexPatch({
             'myext': [mock_ext('myext-0.0.1-py3-none-any.whl', '0.0.1')]
     }), self.assertRaises(NoExtensionCandidatesError):
         resolve_from_index(name)
Exemple #2
0
 def test_no_exts_in_index(self):
     name = 'myext'
     with IndexPatch(
         {}), self.assertRaises(NoExtensionCandidatesError) as err:
         resolve_from_index(name)
     self.assertEqual(str(err.exception),
                      "No extension found with name '{}'".format(name))
Exemple #3
0
 def test_filter_platform_wrong_platform(self):
     name = 'myext'
     # Should raise as we don't support platform specific whls in index
     with IndexPatch({
             'myext':
         [mock_ext('myext-0.0.1-py2.py3-none-x86_64.whl', '0.0.1')]
     }), self.assertRaises(NoExtensionCandidatesError):
         resolve_from_index(name)
Exemple #4
0
 def test_ext_resolved(self):
     name = 'myext'
     index_data = {
         name: [mock_ext('myext-0.0.1-py2.py3-none-any.whl', '0.0.1')]
     }
     with IndexPatch(index_data):
         self.assertEqual(
             resolve_from_index(name)[0],
             index_data[name][0]['downloadUrl'])
Exemple #5
0
 def test_filter_platform(self):
     name = 'myext'
     index_data = {
         'myext': [
             mock_ext('myext-0.0.1-py2.py3-none-any.whl', '0.0.1'),
             mock_ext('myext-0.0.2-py3-none-any.whl', '0.0.2')
         ]
     }
     with IndexPatch(index_data):
         # Should choose the first one as it's not a platform specific whl.
         self.assertEqual(
             resolve_from_index(name)[0],
             index_data[name][0]['downloadUrl'])
Exemple #6
0
 def test_filter_platform(self):
     name = 'myext'
     index_data = {'myext': [mock_ext('myext-0.0.1-py2.py3-none-any.whl', '0.0.1'), mock_ext('myext-0.0.2-py3-none-any.whl', '0.0.2')]}
     with IndexPatch(index_data):
         # Should choose the first one as it's not a platform specific whl.
         self.assertEqual(resolve_from_index(name)[0], index_data[name][0]['downloadUrl'])
Exemple #7
0
 def test_filter_platform_wrong_pyver(self):
     name = 'myext'
     # Should raise as not py2.py3
     with IndexPatch({'myext': [mock_ext('myext-0.0.1-py3-none-any.whl', '0.0.1')]}), self.assertRaises(NoExtensionCandidatesError):
         resolve_from_index(name)
Exemple #8
0
 def test_filter_platform_wrong_platform(self):
     name = 'myext'
     # Should raise as we don't support platform specific whls in index
     with IndexPatch({'myext': [mock_ext('myext-0.0.1-py2.py3-none-x86_64.whl', '0.0.1')]}), self.assertRaises(NoExtensionCandidatesError):
         resolve_from_index(name)
Exemple #9
0
 def test_ext_resolved(self):
     name = 'myext'
     index_data = {name: [mock_ext('myext-0.0.1-py2.py3-none-any.whl', '0.0.1')]}
     with IndexPatch(index_data):
         self.assertEqual(resolve_from_index(name)[0], index_data[name][0]['downloadUrl'])
Exemple #10
0
 def test_ext_not_in_index(self):
     name = 'an_extension_b'
     with IndexPatch({'an_extension_a': []}), self.assertRaises(NoExtensionCandidatesError) as err:
         resolve_from_index(name)
     self.assertEqual(str(err.exception), "No extension found with name '{}'".format(name))