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')
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')
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')
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)
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]
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
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
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
def test_pkginfo_from_no_ext(self): """ .pkginfo_from_file with no extension """ from cheeseprism.index import IndexManager IndexManager.pkginfo_from_file('adfasdkfha')
def test_pkginfo_from_bad_ext(self): """ .pkginfo_from_file with unrecognized extension """ from cheeseprism.index import IndexManager IndexManager.pkginfo_from_file('adfasdkfha.adkfhalsdk')
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
def test_pkginfo_from_no_ext(self): from cheeseprism.index import IndexManager IndexManager.pkginfo_from_file('adfasdkfha')
def test_pkginfo_from_file_egg(self): from cheeseprism.index import IndexManager assert IndexManager.pkginfo_from_file('blah.egg') is True