Пример #1
0
 def test_pkginfo_from_no_ext(self):
     """
     .pkginfo_from_file with no extension
     """
     from cheeseprism.index import IndexManager
     with self.assertRaises(RuntimeError):
         IndexManager.pkginfo_from_file('adfasdkfha')
Пример #2
0
 def test_pkginfo_from_bad_ext(self):
     """
     .pkginfo_from_file with unrecognized extension
     """
     from cheeseprism.index import IndexManager
     with self.assertRaises(RuntimeError):
         IndexManager.pkginfo_from_file('adfasdkfha.adkfhalsdk')
Пример #3
0
 def test_pkginfo_from_bad_ext(self):
     """
     .pkginfo_from_file with unrecognized extension
     """
     from cheeseprism.index import IndexManager
     with self.assertRaises(RuntimeError):
         IndexManager.pkginfo_from_file('adfasdkfha.adkfhalsdk')
Пример #4
0
 def test_pkginfo_from_no_ext(self):
     """
     .pkginfo_from_file with no extension
     """
     from cheeseprism.index import IndexManager
     with self.assertRaises(RuntimeError):
         IndexManager.pkginfo_from_file('adfasdkfha')
Пример #5
0
 def test_pkginfo_from_file_exc(self):
     """
     .pkginfo_from_file with exception and no handler
     """
     from cheeseprism.index import IndexManager
     exc = ValueError("BOOM")
     with patch('pkginfo.bdist.BDist', side_effect=exc):
         IndexManager.pkginfo_from_file('bad.egg')
Пример #6
0
 def test_pkginfo_from_file_exc(self):
     """
     .pkginfo_from_file with exception and no handler
     """
     from cheeseprism.index import IndexManager
     exc = ValueError("BOOM")
     with patch('pkginfo.bdist.BDist', side_effect=exc):
         IndexManager.pkginfo_from_file('bad.egg')
Пример #7
0
 def test_pkginfo_from_bad_ext_handled(self):
     """
     .pkginfo_from_file with unrecognized extension
     """
     from cheeseprism.index import IndexManager
     handler = Mock(name='handler')
     IndexManager.pkginfo_from_file('adfasdkfha.adkfhalsdk', handle_error=handler)
     assert handler.call_args[0][1] == 'adfasdkfha.adkfhalsdk'
     assert isinstance(handler.call_args[0][0], RuntimeError)
Пример #8
0
 def test_pkginfo_from_bad_ext_handled(self):
     """
     .pkginfo_from_file with unrecognized extension
     """
     from cheeseprism.index import IndexManager
     handler = Mock(name='handler')
     IndexManager.pkginfo_from_file('adfasdkfha.adkfhalsdk',
                                    handle_error=handler)
     assert handler.call_args[0][1] == 'adfasdkfha.adkfhalsdk'
     assert isinstance(handler.call_args[0][0], RuntimeError)
Пример #9
0
 def test_pkginfo_from_file_exc_and_handler(self):
     """
     .pkginfo_from_file with exception and handler
     """
     from cheeseprism.index import IndexManager
     exc = Exception("BOOM")
     with patch('pkginfo.bdist.BDist', side_effect=exc):
         eh = Mock(name='error_handler')
         IndexManager.pkginfo_from_file('bad.egg', handle_error=eh)
     assert eh.called
     assert eh.call_args[0] == (exc, 'bad.egg'), eh.call_args[0]
Пример #10
0
 def test_pkginfo_from_file_exc_and_handler(self):
     """
     .pkginfo_from_file with exception and handler
     """
     from cheeseprism.index import IndexManager
     exc = Exception("BOOM")
     with patch('pkginfo.bdist.BDist', side_effect=exc):
         eh = Mock(name='error_handler')
         IndexManager.pkginfo_from_file('bad.egg', handle_error=eh)
     assert eh.called
     assert eh.call_args[0] == (exc, 'bad.egg'), eh.call_args[0]
Пример #11
0
 def test_pkginfo_from_file_sdist(self):
     """
     .pkginfo_from_file: sdist
     """        
     from cheeseprism.index import IndexManager
     for ext in ('.gz','.tgz', '.bz2', '.zip'):
         assert IndexManager.pkginfo_from_file('blah.%s' %ext) is True
Пример #12
0
 def test_pkginfo_from_file_whl(self):
     """
     .pkginfo_from_file: wheel
     """
     from cheeseprism.index import IndexManager
     with patch('pkginfo.wheel.Wheel', new=Mock(return_value=True)):
         assert IndexManager.pkginfo_from_file('blah.whl') is True
Пример #13
0
 def test_pkginfo_from_file_whl(self):
     """
     .pkginfo_from_file: wheel
     """
     from cheeseprism.index import IndexManager
     with patch('pkginfo.wheel.Wheel', new=Mock(return_value=True)):
         assert IndexManager.pkginfo_from_file('blah.whl') is True
Пример #14
0
 def test_pkginfo_from_file_sdist(self):
     """
     .pkginfo_from_file: sdist
     """
     from cheeseprism.index import IndexManager
     for ext in ('.gz', '.tgz', '.bz2', '.zip'):
         assert IndexManager.pkginfo_from_file('blah.%s' % ext) is True
Пример #15
0
 def test_pkginfo_from_no_ext(self):
     """
     .pkginfo_from_file with no extension
     """
     from cheeseprism.index import IndexManager
     IndexManager.pkginfo_from_file('adfasdkfha')        
Пример #16
0
 def test_pkginfo_from_bad_ext(self):
     """
     .pkginfo_from_file with unrecognized extension
     """
     from cheeseprism.index import IndexManager
     IndexManager.pkginfo_from_file('adfasdkfha.adkfhalsdk')
Пример #17
0
 def test_pkginfo_from_no_ext(self):
     """
     .pkginfo_from_file with no extension
     """
     from cheeseprism.index import IndexManager
     IndexManager.pkginfo_from_file('adfasdkfha')
Пример #18
0
 def test_pkginfo_from_bad_ext(self):
     """
     .pkginfo_from_file with unrecognized extension
     """
     from cheeseprism.index import IndexManager
     IndexManager.pkginfo_from_file('adfasdkfha.adkfhalsdk')
Пример #19
0
 def test_pkginfo_from_file_egg(self):
     """
     .pkginfo_from_file: bdist
     """
     from cheeseprism.index import IndexManager
     assert IndexManager.pkginfo_from_file('blah.egg') is True
Пример #20
0
 def test_pkginfo_from_no_ext(self):
     from cheeseprism.index import IndexManager
     IndexManager.pkginfo_from_file('adfasdkfha')        
Пример #21
0
 def test_pkginfo_from_file_egg(self):
     from cheeseprism.index import IndexManager
     assert IndexManager.pkginfo_from_file('blah.egg') is True