def test_pkginfo_conversion(self): # Basic metadata version 1.0 and 1.1 to 1.2 ##expected_metadata = Metadata(os.path.join(MOCK_DISTINFO, 'METADATA')) from pkgmeta.index2repo.egginfo2distinfo import egginfo2distinfo #: Temporary file location for the output expected_distinfo_location = tempfile.mkdtemp('.dist-info', 'pkgmeta-') # Case: mock==0.7.2 distinfo_dir = egginfo2distinfo(MOCK_EGGINFO, expected_distinfo_location) self.assertEqual(distinfo_dir, expected_distinfo_location) self.assertIn('METADATA', os.listdir(distinfo_dir)) metadata = Metadata(os.path.join(distinfo_dir, 'METADATA')) # Ends up metadata version 1.0 because it doesn't have any # PEP 345 markers (e.g. Requires-Dist). self.assertEqual(metadata['Metadata-Version'], '1.0') missing, warnings = metadata.check(strict=True, restructuredtext=True) # Case: wsgioauth==0.3 expected_distinfo_location = tempfile.mkdtemp('.dist-info', 'pkgmeta-') distinfo_dir = egginfo2distinfo(WSGIOAUTH_EGGINFO, expected_distinfo_location) self.assertEqual(distinfo_dir, expected_distinfo_location) self.assertIn('METADATA', os.listdir(distinfo_dir)) metadata = Metadata(os.path.join(distinfo_dir, 'METADATA')) self.assertEqual(metadata['Metadata-Version'], '1.2') missing, warnings = metadata.check(strict=True, restructuredtext=True)
def test_check_homepage(self): metadata = Metadata() metadata['Version'] = '1.0' metadata['Name'] = 'vimpdb' metadata['Author'] = 'Monty Python' metadata.docutils_support = False missing, warnings = metadata.check() self.assertEqual(missing, ['Home-page'])
def test_check_author(self): metadata = Metadata() metadata['Version'] = '1.0' metadata['Name'] = 'vimpdb' metadata['Home-page'] = 'http://pypi.python.org' metadata.docutils_support = False missing, warnings = metadata.check() self.assertEqual(missing, ['Author'])
def test_check_predicates(self): metadata = Metadata() metadata['Version'] = 'rr' metadata['Name'] = 'vimpdb' metadata['Home-page'] = 'http://pypi.python.org' metadata['Author'] = 'Monty Python' metadata['Requires-dist'] = ['Foo (a)'] metadata['Obsoletes-dist'] = ['Foo (a)'] metadata['Provides-dist'] = ['Foo (a)'] missing, warnings = metadata.check() self.assertEqual(len(warnings), 4)