diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py
index 5fd242f..40388f9 100644
--- a/tests/test_manifest_xml.py
+++ b/tests/test_manifest_xml.py
@@ -24,6 +24,38 @@ import error
import manifest_xml
+class ManifestParseTestCase(unittest.TestCase):
+ """TestCase for parsing manifests."""
+
+ def setUp(self):
+ self.tempdir = tempfile.mkdtemp(prefix='repo_tests')
+ self.repodir = os.path.join(self.tempdir, '.repo')
+ self.manifest_dir = os.path.join(self.repodir, 'manifests')
+ self.manifest_file = os.path.join(
+ self.repodir, manifest_xml.MANIFEST_FILE_NAME)
+ self.local_manifest_dir = os.path.join(
+ self.repodir, manifest_xml.LOCAL_MANIFESTS_DIR_NAME)
+ os.mkdir(self.repodir)
+ os.mkdir(self.manifest_dir)
+
+ # The manifest parsing really wants a git repo currently.
+ gitdir = os.path.join(self.repodir, 'manifests.git')
+ os.mkdir(gitdir)
+ with open(os.path.join(gitdir, 'config'), 'w') as fp:
+ fp.write("""[remote "origin"]
+ url = https://localhost:0/manifest
+""")
+
+ def tearDown(self):
+ shutil.rmtree(self.tempdir, ignore_errors=True)
+
+ def getXmlManifest(self, data):
+ """Helper to initialize a manifest for testing."""
+ with open(self.manifest_file, 'w') as fp:
+ fp.write(data)
+ return manifest_xml.XmlManifest(self.repodir, self.manifest_file)
+
+
class ManifestValidateFilePaths(unittest.TestCase):
"""Check _ValidateFilePaths helper.
@@ -146,37 +178,9 @@ class ValueTests(unittest.TestCase):
manifest_xml.XmlInt(node, 'a')
-class XmlManifestTests(unittest.TestCase):
+class XmlManifestTests(ManifestParseTestCase):
"""Check manifest processing."""
- def setUp(self):
- self.tempdir = tempfile.mkdtemp(prefix='repo_tests')
- self.repodir = os.path.join(self.tempdir, '.repo')
- self.manifest_dir = os.path.join(self.repodir, 'manifests')
- self.manifest_file = os.path.join(
- self.repodir, manifest_xml.MANIFEST_FILE_NAME)
- self.local_manifest_dir = os.path.join(
- self.repodir, manifest_xml.LOCAL_MANIFESTS_DIR_NAME)
- os.mkdir(self.repodir)
- os.mkdir(self.manifest_dir)
-
- # The manifest parsing really wants a git repo currently.
- gitdir = os.path.join(self.repodir, 'manifests.git')
- os.mkdir(gitdir)
- with open(os.path.join(gitdir, 'config'), 'w') as fp:
- fp.write("""[remote "origin"]
- url = https://localhost:0/manifest
-""")
-
- def tearDown(self):
- shutil.rmtree(self.tempdir, ignore_errors=True)
-
- def getXmlManifest(self, data):
- """Helper to initialize a manifest for testing."""
- with open(self.manifest_file, 'w') as fp:
- fp.write(data)
- return manifest_xml.XmlManifest(self.repodir, self.manifest_file)
-
def test_empty(self):
"""Parse an 'empty' manifest file."""
manifest = self.getXmlManifest(
@@ -221,67 +225,6 @@ class XmlManifestTests(unittest.TestCase):
self.assertEqual(manifest.repo_hooks_project.name, 'repohooks')
self.assertEqual(manifest.repo_hooks_project.enabled_repo_hooks, ['a', 'b'])
- def test_superproject(self):
- """Check superproject settings."""
- manifest = self.getXmlManifest("""
-
-
-
-
-
-""")
- self.assertEqual(manifest.superproject['name'], 'superproject')
- self.assertEqual(manifest.superproject['remote'].name, 'test-remote')
- self.assertEqual(manifest.superproject['remote'].url, 'http://localhost/superproject')
- self.assertEqual(
- manifest.ToXml().toxml(),
- '' +
- '' +
- '' +
- '' +
- '')
-
- def test_superproject_with_remote(self):
- """Check superproject settings."""
- manifest = self.getXmlManifest("""
-
-
-
-
-
-
-""")
- self.assertEqual(manifest.superproject['name'], 'platform/superproject')
- self.assertEqual(manifest.superproject['remote'].name, 'superproject-remote')
- self.assertEqual(manifest.superproject['remote'].url, 'http://localhost/platform/superproject')
- self.assertEqual(
- manifest.ToXml().toxml(),
- '' +
- '' +
- '' +
- '' +
- '' +
- '')
-
- def test_superproject_with_defalut_remote(self):
- """Check superproject settings."""
- manifest = self.getXmlManifest("""
-
-
-
-
-
-""")
- self.assertEqual(manifest.superproject['name'], 'superproject')
- self.assertEqual(manifest.superproject['remote'].name, 'default-remote')
- self.assertEqual(
- manifest.ToXml().toxml(),
- '' +
- '' +
- '' +
- '' +
- '')
-
def test_unknown_tags(self):
"""Check superproject settings."""
manifest = self.getXmlManifest("""
@@ -389,3 +332,68 @@ class XmlManifestTests(unittest.TestCase):
self.assertIn('level2-group', proj.groups)
# Check level2 proj group not removed.
self.assertIn('l2g1', proj.groups)
+
+
+class SuperProjectTests(ManifestParseTestCase):
+ """Tests for ."""
+
+ def test_superproject(self):
+ """Check superproject settings."""
+ manifest = self.getXmlManifest("""
+
+
+
+
+
+""")
+ self.assertEqual(manifest.superproject['name'], 'superproject')
+ self.assertEqual(manifest.superproject['remote'].name, 'test-remote')
+ self.assertEqual(manifest.superproject['remote'].url, 'http://localhost/superproject')
+ self.assertEqual(
+ manifest.ToXml().toxml(),
+ '' +
+ '' +
+ '' +
+ '' +
+ '')
+
+ def test_remote(self):
+ """Check superproject settings with a remote."""
+ manifest = self.getXmlManifest("""
+
+
+
+
+
+
+""")
+ self.assertEqual(manifest.superproject['name'], 'platform/superproject')
+ self.assertEqual(manifest.superproject['remote'].name, 'superproject-remote')
+ self.assertEqual(manifest.superproject['remote'].url, 'http://localhost/platform/superproject')
+ self.assertEqual(
+ manifest.ToXml().toxml(),
+ '' +
+ '' +
+ '' +
+ '' +
+ '' +
+ '')
+
+ def test_defalut_remote(self):
+ """Check superproject settings with a default remote."""
+ manifest = self.getXmlManifest("""
+
+
+
+
+
+""")
+ self.assertEqual(manifest.superproject['name'], 'superproject')
+ self.assertEqual(manifest.superproject['remote'].name, 'default-remote')
+ self.assertEqual(
+ manifest.ToXml().toxml(),
+ '' +
+ '' +
+ '' +
+ '' +
+ '')