summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_manifest_xml.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py
index 648acde8..ef511055 100644
--- a/tests/test_manifest_xml.py
+++ b/tests/test_manifest_xml.py
@@ -389,6 +389,45 @@ class XmlManifestTests(ManifestParseTestCase):
389class IncludeElementTests(ManifestParseTestCase): 389class IncludeElementTests(ManifestParseTestCase):
390 """Tests for <include>.""" 390 """Tests for <include>."""
391 391
392 def test_revision_default(self):
393 """Check handling of revision attribute."""
394 root_m = os.path.join(self.manifest_dir, "root.xml")
395 with open(root_m, "w") as fp:
396 fp.write(
397 """
398<manifest>
399 <remote name="test-remote" fetch="http://localhost" />
400 <default remote="test-remote" revision="refs/heads/main" />
401 <include name="stable.xml" revision="stable-branch" />
402 <project name="root-name1" path="root-path1" />
403 <project name="root-name2" path="root-path2" />
404</manifest>
405"""
406 )
407 with open(os.path.join(self.manifest_dir, "stable.xml"), "w") as fp:
408 fp.write(
409 """
410<manifest>
411 <project name="stable-name1" path="stable-path1" />
412 <project name="stable-name2" path="stable-path2" revision="stable-branch2" />
413</manifest>
414"""
415 )
416 include_m = manifest_xml.XmlManifest(self.repodir, root_m)
417 for proj in include_m.projects:
418 if proj.name == "root-name1":
419 # Check include revision not set on root level proj.
420 self.assertNotEqual("stable-branch", proj.revisionExpr)
421 if proj.name == "root-name2":
422 # Check root proj revision not removed.
423 self.assertEqual("refs/heads/main", proj.revisionExpr)
424 if proj.name == "stable-name1":
425 # Check stable proj has inherited revision include node.
426 self.assertEqual("stable-branch", proj.revisionExpr)
427 if proj.name == "stable-name2":
428 # Check stable proj revision can override include node.
429 self.assertEqual("stable-branch2", proj.revisionExpr)
430
392 def test_group_levels(self): 431 def test_group_levels(self):
393 root_m = os.path.join(self.manifest_dir, "root.xml") 432 root_m = os.path.join(self.manifest_dir, "root.xml")
394 with open(root_m, "w") as fp: 433 with open(root_m, "w") as fp: