def test_empty_double_namespace_package(self): s = StringIO() p = Package(s, "test.namespace.another", "1.0") p.close() self.assertEqual(p.sources, [ 'test.namespace.another-1.0/setup.py', 'test.namespace.another-1.0/test/__init__.py', 'test.namespace.another-1.0/test/namespace/__init__.py', 'test.namespace.another-1.0/PKG-INFO', 'test.namespace.another-1.0/test.namespace.another.egg-info/PKG-INFO', 'test.namespace.another-1.0/test.namespace.another.egg-info/top_level.txt', 'test.namespace.another-1.0/test.namespace.another.egg-info/namespace_packages.txt', 'test.namespace.another-1.0/test.namespace.another.egg-info/requires.txt', 'test.namespace.another-1.0/test.namespace.another.egg-info/entry_points.txt', 'test.namespace.another-1.0/test.namespace.another.egg-info/not-zip-safe', 'test.namespace.another-1.0/test.namespace.another.egg-info/dependency_links.txt', 'test.namespace.another-1.0/test.namespace.another.egg-info/SOURCES.txt' ]) z = zipfile.ZipFile(s) # Verify SOURCES.txt is accurate SOURCES = ["test.namespace.another-1.0/" + x for x in z.open('test.namespace.another-1.0/test.namespace.another.egg-info/SOURCES.txt').read().splitlines()] self.assertEqual(SOURCES, p.sources) self.assert_(self.is_namespace_file(z, "test.namespace.another-1.0/test/__init__.py")) self.assert_(self.is_namespace_file(z, "test.namespace.another-1.0/test/namespace/__init__.py")) self.assert_(not self.is_namespace_file(z, "test.namespace.another-1.0/test/namespace/another/__init__.py")) self.assertEqual(z.open("test.namespace.another-1.0/test.namespace.another.egg-info/entry_points.txt").read().strip(), "")
def test_empty_package(self): s = StringIO() p = Package(s, "test", "1.0") p.close() # Verify all package metadata is present self.assertEqual(p.sources, [ 'test-1.0/setup.py', 'test-1.0/PKG-INFO', 'test-1.0/test.egg-info/PKG-INFO', 'test-1.0/test.egg-info/top_level.txt', 'test-1.0/test.egg-info/namespace_packages.txt', 'test-1.0/test.egg-info/requires.txt', 'test-1.0/test.egg-info/entry_points.txt', 'test-1.0/test.egg-info/not-zip-safe', 'test-1.0/test.egg-info/dependency_links.txt', 'test-1.0/test.egg-info/SOURCES.txt' ]) z = zipfile.ZipFile(s) # Verify SOURCES.txt is accurate SOURCES = ["test-1.0/" + x for x in z.open('test-1.0/test.egg-info/SOURCES.txt').read().splitlines()] self.assertEqual(SOURCES, p.sources) self.assertEqual(z.open("test-1.0/test.egg-info/entry_points.txt").read().strip(), "")