From b2b80e3b57615aee491d2e384d55e73045b27cca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Wed, 9 Mar 2022 15:23:40 +0100
Subject: [PATCH] Revert "Add python tests for parsing metadata together"
This reverts commit 0c050128f7e24222011cdfcc67ba58da744affa9.
---
tests/python/tests/test_xml_parser.py | 206 --------------------------
1 file changed, 206 deletions(-)
diff --git a/tests/python/tests/test_xml_parser.py b/tests/python/tests/test_xml_parser.py
index ed13cac..ddc089f 100644
--- a/tests/python/tests/test_xml_parser.py
+++ b/tests/python/tests/test_xml_parser.py
@@ -950,209 +950,3 @@ class TestCaseXmlParserRepomd(unittest.TestCase):
self.assertEqual(repomd.content_tags, [])
self.assertEqual(len(repomd.records), 3)
-class TestCaseXmlParserMainMetadataTogether(unittest.TestCase):
- def test_xml_parser_main_metadata_together_repo01(self):
- userdata = {
- "pkgs": [],
- "pkgcb_calls": 0,
- "warnings": []
- }
-
- def newpkgcb(pkgId, name, arch):
- pkg = cr.Package()
- userdata["pkgs"].append(pkg)
- return pkg
-
- def pkgcb(pkg):
- userdata["pkgcb_calls"] += 1
-
- def warningcb(warn_type, msg):
- userdata["warnings"].append((warn_type, msg))
-
- cr.xml_parse_main_metadata_together(primary=REPO_01_PRIXML, filelists=REPO_01_FILXML, other=REPO_01_OTHXML,
- newpkgcb=newpkgcb, pkgcb=pkgcb, warningcb=warningcb)
-
- self.assertEqual([pkg.name for pkg in userdata["pkgs"]], ['super_kernel'])
- self.assertEqual(userdata["pkgcb_calls"], 1)
- self.assertEqual(userdata["warnings"], [])
-
- pkg = userdata["pkgs"][0]
- self.assertEqual(pkg.pkgId, "152824bff2aa6d54f429d43e87a3ff3a0286505c6d93ec87692b5e3a9e3b97bf")
- self.assertEqual(pkg.name, "super_kernel")
- self.assertEqual(pkg.arch, "x86_64")
- self.assertEqual(pkg.version, "6.0.1")
- self.assertEqual(pkg.epoch, "0")
- self.assertEqual(pkg.release, "2")
- self.assertEqual(pkg.summary, "Test package")
- self.assertEqual(pkg.description, "This package has provides, requires, obsoletes, conflicts options.")
- self.assertEqual(pkg.url, "http://so_super_kernel.com/it_is_awesome/yep_it_really_is")
- self.assertEqual(pkg.time_file, 1334667003)
- self.assertEqual(pkg.time_build, 1334667003)
- self.assertEqual(pkg.rpm_license, "LGPLv2")
- self.assertEqual(pkg.rpm_vendor, None)
- self.assertEqual(pkg.rpm_group, "Applications/System")
- self.assertEqual(pkg.rpm_buildhost, "localhost.localdomain")
- self.assertEqual(pkg.rpm_sourcerpm, "super_kernel-6.0.1-2.src.rpm")
- self.assertEqual(pkg.rpm_header_start, 280)
- self.assertEqual(pkg.rpm_header_end, 2637)
- self.assertEqual(pkg.rpm_packager, None)
- self.assertEqual(pkg.size_package, 2845)
- self.assertEqual(pkg.size_installed, 0)
- self.assertEqual(pkg.size_archive, 404)
- self.assertEqual(pkg.location_href, "super_kernel-6.0.1-2.x86_64.rpm")
- self.assertEqual(pkg.location_base, None)
- self.assertEqual(pkg.checksum_type, "sha256")
- self.assertEqual(pkg.requires,
- [('bzip2', 'GE', '0', '1.0.0', None, True),
- ('expat', None, None, None, None, True),
- ('glib', 'GE', '0', '2.26.0', None, False),
- ('zlib', None, None, None, None, False)])
- self.assertEqual(pkg.provides,
- [('not_so_super_kernel', 'LT', '0', '5.8.0', None, False),
- ('super_kernel', 'EQ', '0', '6.0.0', None, False),
- ('super_kernel', 'EQ', '0', '6.0.1', '2', False),
- ('super_kernel(x86-64)', 'EQ', '0', '6.0.1', '2', False)])
- self.assertEqual(pkg.conflicts,
- [('kernel', None, None, None, None, False),
- ('super_kernel', 'EQ', '0', '5.0.0', None, False),
- ('super_kernel', 'LT', '0', '4.0.0', None, False)])
- self.assertEqual(pkg.obsoletes,
- [('kernel', None, None, None, None, False),
- ('super_kernel', 'EQ', '0', '5.9.0', None, False)])
- self.assertEqual(pkg.files,
- [(None, '/usr/bin/', 'super_kernel'),
- (None, '/usr/share/man/', 'super_kernel.8.gz')])
- self.assertEqual(pkg.changelogs,
- [('Tomas Mlcoch <tmlcoch@redhat.com> - 6.0.1-1',
- 1334664000,
- '- First release'),
- ('Tomas Mlcoch <tmlcoch@redhat.com> - 6.0.1-2',
- 1334664001,
- '- Second release')])
-
- def test_xml_parser_main_metadata_together_repo02(self):
-
- userdata = {
- "pkgs": [],
- "pkgcb_calls": 0,
- "warnings": []
- }
-
- def newpkgcb(pkgId, name, arch):
- pkg = cr.Package()
- userdata["pkgs"].append(pkg)
- return pkg
-
- def pkgcb(pkg):
- userdata["pkgcb_calls"] += 1
-
- def warningcb(warn_type, msg):
- userdata["warnings"].append((warn_type, msg))
-
- cr.xml_parse_main_metadata_together(REPO_02_PRIXML, REPO_02_FILXML, REPO_02_OTHXML, newpkgcb, pkgcb, warningcb,
- allow_out_of_order=True)
-
- self.assertEqual([pkg.name for pkg in userdata["pkgs"]],
- ['fake_bash', 'super_kernel'])
- self.assertEqual(userdata["pkgcb_calls"], 2)
- self.assertEqual(userdata["warnings"], [])
-
- def test_xml_parser_main_metadata_together_repo02_only_pkgcb(self):
-
- pkgs = []
-
- def pkgcb(pkg):
- pkgs.append(pkg)
-
- cr.xml_parse_main_metadata_together(REPO_02_PRIXML, REPO_02_FILXML, REPO_02_OTHXML,
- None, pkgcb, None)
-
- self.assertEqual([pkg.name for pkg in pkgs],
- ['fake_bash', 'super_kernel'])
-
- def test_xml_parser_main_metadata_together_repo02_no_cbs(self):
- self.assertRaises(ValueError,
- cr.xml_parse_main_metadata_together,
- REPO_02_PRIXML, REPO_02_FILXML, REPO_02_OTHXML,
- None, None, None)
-
- def test_xml_parser_main_metadata_together_warnings(self):
- userdata = {
- "pkgs": [],
- "warnings": []
- }
-
- def newpkgcb(pkgId, name, arch):
- pkg = cr.Package()
- userdata["pkgs"].append(pkg)
- return pkg
-
- def warningcb(warn_type, msg):
- userdata["warnings"].append((warn_type, msg))
-
- cr.xml_parse_main_metadata_together(PRIMARY_MULTI_WARN_00_PATH,
- FILELISTS_MULTI_WARN_00_PATH,
- OTHER_MULTI_WARN_00_PATH,
- newpkgcb, None, warningcb)
-
- self.assertEqual([pkg.name for pkg in userdata["pkgs"]],
- ['fake_bash', 'super_kernel'])
- self.assertEqual(userdata["warnings"],
- [(0, 'Unknown element "fooelement"'),
- (1, 'Missing attribute "type" of a package element'),
- (0, 'Unknown element "foo"'),
- (3, 'Conversion of "foobar" to integer failed'),
- (0, 'Unknown element "bar"'),
- (1, 'Missing attribute "arch" of a package element'),
- (2, 'Unknown file type "xxx"'),
- (0, 'Unknown element "bar"'),
- (1, 'Missing attribute "name" of a package element'),
- (0, 'Unknown element "bar"'),
- (3, 'Conversion of "xxx" to integer failed')])
-
-
- def test_xml_parser_main_metadata_together_error(self):
- userdata = { "pkgs": [] }
-
- def newpkgcb(pkgId, name, arch):
- pkg = cr.Package()
- userdata["pkgs"].append(pkg)
- return pkg
-
- self.assertRaises(cr.CreaterepoCError, cr.xml_parse_main_metadata_together,
- PRIMARY_ERROR_00_PATH, FILELISTS_ERROR_00_PATH,
- OTHER_ERROR_00_PATH, newpkgcb, None, None)
-
- # unlike parsing just primary, filelists or other separately when parsing together primary is parsed first fully
- # before newpkgcb is called so the error is detected before any user package is created
- self.assertEqual(len(userdata["pkgs"]), 0)
-
- def test_xml_parser_main_metadata_together_newpkgcb_abort(self):
- def newpkgcb(pkgId, name, arch):
- raise Error("Foo error")
- self.assertRaises(cr.CreaterepoCError,
- cr.xml_parse_main_metadata_together,
- REPO_02_PRIXML, REPO_02_FILXML, REPO_02_OTHXML,
- newpkgcb, None, None)
-
- def test_xml_parser_main_metadata_together_pkgcb_abort(self):
- def newpkgcb(pkgId, name, arch):
- return cr.Package()
- def pkgcb(pkg):
- raise Error("Foo error")
- self.assertRaises(cr.CreaterepoCError,
- cr.xml_parse_main_metadata_together,
- REPO_02_PRIXML, REPO_02_FILXML, REPO_02_OTHXML,
- newpkgcb, pkgcb, None)
-
- def test_xml_parser_main_metadata_together_warningcb_abort(self):
- def newpkgcb(pkgId, name, arch):
- return cr.Package()
- def warningcb(type, msg):
- raise Error("Foo error")
- self.assertRaises(cr.CreaterepoCError,
- cr.xml_parse_main_metadata_together,
- PRIMARY_MULTI_WARN_00_PATH,
- FILELISTS_MULTI_WARN_00_PATH,
- OTHER_MULTI_WARN_00_PATH,
- newpkgcb, None, warningcb)
--
2.34.3