-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow incremental parsing without filelists or other xml
Supplying a NULL value as a filelists or other "path" argument ought to work. closes #423
- Loading branch information
Showing
5 changed files
with
145 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1245,6 +1245,54 @@ def warningcb(warn_type, msg): | |
self.assertRaises(StopIteration, next, package_iterator) | ||
self.assertTrue(package_iterator.is_finished()) | ||
|
||
def test_xml_parser_pkg_iterator_repo02_no_filelists(self): | ||
warnings = [] | ||
def warningcb(warn_type, msg): | ||
warnings.append((warn_type, msg)) | ||
|
||
package_iterator = cr.PackageIterator( | ||
primary_path=REPO_02_PRIXML, filelists_path=None, other_path=REPO_02_OTHXML, | ||
warningcb=warningcb, | ||
) | ||
packages = list(package_iterator) | ||
|
||
self.assertEqual(len(packages), 2) | ||
self.assertEqual(packages[0].name, "fake_bash") | ||
self.assertEqual(packages[0].changelogs, [ | ||
('Tomas Mlcoch <[email protected]> - 1.1.1-1', 1334664000, '- First release'), | ||
]) | ||
self.assertEqual(packages[0].files, [(None, '/usr/bin/', 'fake_bash')]) # the files still get parsed - only from primary.xml | ||
self.assertListEqual(warnings, []) | ||
self.assertRaises(StopIteration, next, package_iterator) | ||
self.assertTrue(package_iterator.is_finished()) | ||
|
||
def test_xml_parser_pkg_iterator_repo02_no_primary(self): | ||
def test(): | ||
cr.PackageIterator( | ||
primary_path=None, filelists_path=REPO_02_FILXML, other_path=REPO_02_OTHXML, | ||
) | ||
|
||
self.assertRaises(TypeError, test) | ||
|
||
def test_xml_parser_pkg_iterator_repo02_no_other(self): | ||
warnings = [] | ||
def warningcb(warn_type, msg): | ||
warnings.append((warn_type, msg)) | ||
|
||
package_iterator = cr.PackageIterator( | ||
primary_path=REPO_02_PRIXML, filelists_path=REPO_02_FILXML, other_path=None, | ||
warningcb=warningcb, | ||
) | ||
packages = list(package_iterator) | ||
|
||
self.assertEqual(len(packages), 2) | ||
self.assertEqual(packages[0].name, "fake_bash") | ||
self.assertEqual(packages[0].changelogs, []) | ||
self.assertEqual(packages[0].files, [(None, '/usr/bin/', 'fake_bash')]) | ||
self.assertListEqual(warnings, []) | ||
self.assertRaises(StopIteration, next, package_iterator) | ||
self.assertTrue(package_iterator.is_finished()) | ||
|
||
def test_xml_parser_pkg_iterator_repo02_newpkgcb_as_filter(self): | ||
def newpkgcb(pkgId, name, arch): | ||
if name in {"fake_bash"}: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters