From 83544e45d798a9a1b179af3d24182fd1348d0187 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Thu, 27 Oct 2022 15:15:23 +0200 Subject: [PATCH] Add a test case for a simpler and newer package --- tests/fixtures/clapper-data.yaml | 447 ++++++++++++++++++++++ tests/fixtures/clapper-expected-tree.yaml | 7 + tests/tree_test.py | 34 +- 3 files changed, 475 insertions(+), 13 deletions(-) create mode 100644 tests/fixtures/clapper-data.yaml create mode 100644 tests/fixtures/clapper-expected-tree.yaml diff --git a/tests/fixtures/clapper-data.yaml b/tests/fixtures/clapper-data.yaml new file mode 100644 index 0000000..e64372a --- /dev/null +++ b/tests/fixtures/clapper-data.yaml @@ -0,0 +1,447 @@ +revisions: +- broken: false + comment: New package. Multimedia player. + commit_time: 2021-12-04 09:09:45 + expanded_srcmd5: 59322d653fd83dc0f5ab824a0a03630e + files: + - md5: a33ee58d8ad248ae6f606f3eeba13d0a + mtime: 1631502957 + name: clapper-0.4.0.tar.gz + size: 177088 + - md5: 5ac370642ac4b1da94f37131e70a9d67 + mtime: 1633346919 + name: clapper.changes + size: 2779 + - md5: bde872ed7fbe82f1efa4f79b36832e41 + mtime: 1638563275 + name: clapper.spec + size: 3184 + files_hash: c41f6b079a31f4f22843a7c6d0153086 + package: clapper + project: multimedia:apps + request: + creator: iznogood + number: 935592 + source_package: clapper + source_project: home:iznogood + source_rev: '10' + state: accepted + type: submit + rev: 1.0 + unexpanded_srcmd5: 59322d653fd83dc0f5ab824a0a03630e + userid: tiwai +- broken: false + comment: New upstream release + commit_time: 2022-02-26 12:12:01 + expanded_srcmd5: b5494836ea0fcac18280f95df6756d51 + files: + - md5: e6c61dadeb7745c09d9ae1f7225a4e20 + mtime: 1640080764 + name: clapper-0.4.1.tar.gz + size: 189352 + - md5: cb6cc341db07e6c7c594991e98e5ff4e + mtime: 1645873920 + name: clapper.changes + size: 3465 + - md5: c48e75dcb803199c14382b8d1c8ae59b + mtime: 1645873920 + name: clapper.spec + size: 3184 + files_hash: 32dd4bbef535a2d593b7b7a39cecadee + package: clapper + project: multimedia:apps + rev: 2.0 + unexpanded_srcmd5: b5494836ea0fcac18280f95df6756d51 + userid: iznogood +- broken: false + comment: Tweaks + commit_time: 2022-02-26 12:24:44 + expanded_srcmd5: d9c86e4f705c838e19b218f0f855c506 + files: + - md5: e6c61dadeb7745c09d9ae1f7225a4e20 + mtime: 1640080764 + name: clapper-0.4.1.tar.gz + size: 189352 + - md5: cb6cc341db07e6c7c594991e98e5ff4e + mtime: 1645873920 + name: clapper.changes + size: 3465 + - md5: 8b31c5a7b11ce5df77a054aa5889455c + mtime: 1645874684 + name: clapper.spec + size: 3216 + files_hash: 57b82960f963280f9b63a0c08533bd40 + package: clapper + project: multimedia:apps + rev: 3.0 + unexpanded_srcmd5: d9c86e4f705c838e19b218f0f855c506 + userid: iznogood +- broken: false + comment: initialized devel package after accepting 957803 + commit_time: 2022-02-27 22:42:56 + expanded_srcmd5: faf9884a10c957ba9f2e5d17e9fdec24 + files: + - md5: e6c61dadeb7745c09d9ae1f7225a4e20 + mtime: 1640080764 + name: clapper-0.4.1.tar.gz + size: 189352 + - md5: cb6cc341db07e6c7c594991e98e5ff4e + mtime: 1645873920 + name: clapper.changes + size: 3465 + - md5: 8b31c5a7b11ce5df77a054aa5889455c + mtime: 1645874684 + name: clapper.spec + size: 3216 + files_hash: 57b82960f963280f9b63a0c08533bd40 + package: clapper + project: multimedia:apps + request: + creator: iznogood + number: 957803 + source_package: clapper + source_project: multimedia:apps + source_rev: d9c86e4f705c838e19b218f0f855c506 + state: accepted + type: submit + rev: 4.0 + unexpanded_srcmd5: 3964b46fc8766b687555e096f80e9210 + userid: dimstar_suse +- broken: false + comment: "- Update to version 0.5.1:\n * A quick hotfix release. Fixes problems\ + \ with new video sink on\n displays with non-100% scaling applied.\n- Changes\ + \ from version 0.5.0:\n * Clapper now includes an all new and improved GStreamer\ + \ video\n sink. With it, we are moving away from GLArea into using\n GdkPaintable.\ + \ This already gives us slight performance\n improvement in some cases and\ + \ opens new possibilities to\n improve it further at a later time. New sink\ + \ now also handles\n overlaying and displaying subtitles on the GTK side of\ + \ things\n (as a separate GdkTextures instead of drawing them into\n framebuffer).\ + \ Old, now called \"legacy\" sink is still included.\n If there are any problems\ + \ with the new one, you can set\n CLAPPER_USE_LEGACY_SINK=1 env to use the\ + \ old one.\n * Networking was ported into libsoup3. The built-in, unfinished\n\ + \ web application was removed.\n * Additionally, app now supports D-Bus launching\n\ + \ (DBusActivatable).\n * Some other misc fixes and few small UI changes were\ + \ also done.\n * Updated translations.\n- Update libnames define to align with\ + \ soname.\n" + commit_time: 2022-06-20 10:28:02 + expanded_srcmd5: 6aadd1b991a8e6e5c73a1c92ad607ffe + files: + - md5: 4b17fee0a0c0c7e4e17342060423fd6b + mtime: 1653827577 + name: clapper-0.5.1.tar.gz + size: 205892 + - md5: f38d8401e908e50cc59ddcdc4cdca2b7 + mtime: 1655288124 + name: clapper.changes + size: 4698 + - md5: 7dcdfd96c3ddb14cc9d2078c104d70ef + mtime: 1655285565 + name: clapper.spec + size: 3778 + files_hash: 2a42f20c5ecd3d6134be61e3a7bde8ef + package: clapper + project: multimedia:apps + request: + creator: iznogood + number: 983879 + source_package: clapper + source_project: GNOME:Next + source_rev: '2' + state: accepted + type: submit + rev: 5.0 + unexpanded_srcmd5: 76a14fe34efcae604b08259a632505db + userid: iznogood +- broken: false + comment: Rename again + commit_time: 2022-06-20 15:10:32 + expanded_srcmd5: 8a565d68aa606989026f2420269d89d7 + files: + - md5: 4b17fee0a0c0c7e4e17342060423fd6b + mtime: 1653827577 + name: clapper-0.5.1.tar.gz + size: 205892 + - md5: f38d8401e908e50cc59ddcdc4cdca2b7 + mtime: 1655288124 + name: clapper.changes + size: 4698 + - md5: 2e9fe16f709d1bb1882cf5395e68759e + mtime: 1655730632 + name: clapper.spec + size: 3777 + files_hash: 9ed5a33bce8d597a5d05b5a0992e06c9 + package: clapper + project: multimedia:apps + rev: 6.0 + unexpanded_srcmd5: e737089265a084f7aad10abd3be2c4bd + userid: iznogood +- broken: false + comment: Obsolete old soname + commit_time: 2022-06-20 15:11:36 + expanded_srcmd5: 179be2df4942f26148a025952b88f03d + files: + - md5: 4b17fee0a0c0c7e4e17342060423fd6b + mtime: 1653827577 + name: clapper-0.5.1.tar.gz + size: 205892 + - md5: f38d8401e908e50cc59ddcdc4cdca2b7 + mtime: 1655288124 + name: clapper.changes + size: 4698 + - md5: ce1300968ea115c15788342685fd72c9 + mtime: 1655730696 + name: clapper.spec + size: 3853 + files_hash: 0f6ed5f9ce80048e6f356a93cceda5f7 + package: clapper + project: multimedia:apps + rev: 7.0 + unexpanded_srcmd5: ac0573a99d2025718fbdad0ee2645e1d + userid: iznogood +- broken: false + comment: Updating link to change in openSUSE:Factory/clapper revision 2.0 + commit_time: 2022-06-20 15:38:39 + expanded_srcmd5: d6e3df5c8e35859600c107ff77ac1b24 + files: + - md5: 4b17fee0a0c0c7e4e17342060423fd6b + mtime: 1653827577 + name: clapper-0.5.1.tar.gz + size: 205892 + - md5: f38d8401e908e50cc59ddcdc4cdca2b7 + mtime: 1655288124 + name: clapper.changes + size: 4698 + - md5: ce1300968ea115c15788342685fd72c9 + mtime: 1655730696 + name: clapper.spec + size: 3853 + files_hash: 0f6ed5f9ce80048e6f356a93cceda5f7 + package: clapper + project: multimedia:apps + rev: 7.002 + unexpanded_srcmd5: ac0573a99d2025718fbdad0ee2645e1d + userid: buildservice-autocommit +- broken: false + comment: baserev update by copy to link target + commit_time: 2022-06-20 15:38:40 + expanded_srcmd5: c46d58d4175a88718faabce1d220f4cf + files: + - md5: 4b17fee0a0c0c7e4e17342060423fd6b + mtime: 1653827577 + name: clapper-0.5.1.tar.gz + size: 205892 + - md5: f38d8401e908e50cc59ddcdc4cdca2b7 + mtime: 1655288124 + name: clapper.changes + size: 4698 + - md5: ce1300968ea115c15788342685fd72c9 + mtime: 1655730696 + name: clapper.spec + size: 3853 + files_hash: 0f6ed5f9ce80048e6f356a93cceda5f7 + package: clapper + project: multimedia:apps + request: + creator: iznogood + number: 983983 + source_package: clapper + source_project: multimedia:apps + source_rev: 179be2df4942f26148a025952b88f03d + state: accepted + type: submit + rev: 8.0 + unexpanded_srcmd5: 5cc7750e155267d9979011e91020fe35 + userid: buildservice-autocommit +- broken: false + comment: "- Update to version 0.5.2:\n + Fix time labels display on RTL languages\n\ + \ + Improved GL/GLES context automatic selection\n + Updated translations." + commit_time: 2022-08-26 09:20:47 + expanded_srcmd5: 3da0f4e851d0205f21bfc12cfd23c24c + files: + - md5: e8d358ab1f56e738656220a652af978a + mtime: 1656076496 + name: clapper-0.5.2.tar.gz + size: 207254 + - md5: f67e643f6442243cd1e03fa06c197a70 + mtime: 1661498175 + name: clapper.changes + size: 4979 + - md5: ded2042fd0ead479cdfda4b06ade142c + mtime: 1661498175 + name: clapper.spec + size: 3853 + files_hash: d1ec7172b6fbcfbb7dbde2f8892e6b5e + package: clapper + project: multimedia:apps + request: + creator: iznogood + number: 999353 + source_package: clapper + source_project: home:iznogood:branches:multimedia:apps + source_rev: '2' + state: accepted + type: submit + rev: 9.0 + unexpanded_srcmd5: 0e3bac004dfc1767aadb91fd8f3bb141 + userid: iznogood +- broken: false + comment: Updating link to change in openSUSE:Factory/clapper revision 3.0 + commit_time: 2022-08-27 11:49:46 + expanded_srcmd5: 4b2e69d67d071550c795e11e07cdb7a3 + files: + - md5: e8d358ab1f56e738656220a652af978a + mtime: 1656076496 + name: clapper-0.5.2.tar.gz + size: 207254 + - md5: f67e643f6442243cd1e03fa06c197a70 + mtime: 1661498175 + name: clapper.changes + size: 4979 + - md5: ded2042fd0ead479cdfda4b06ade142c + mtime: 1661498175 + name: clapper.spec + size: 3853 + files_hash: d1ec7172b6fbcfbb7dbde2f8892e6b5e + package: clapper + project: multimedia:apps + rev: 9.003 + unexpanded_srcmd5: 0e3bac004dfc1767aadb91fd8f3bb141 + userid: buildservice-autocommit +- broken: false + comment: baserev update by copy to link target + commit_time: 2022-08-27 11:49:46 + expanded_srcmd5: 27d5530be61fa2053a93ed0ceaa61600 + files: + - md5: e8d358ab1f56e738656220a652af978a + mtime: 1656076496 + name: clapper-0.5.2.tar.gz + size: 207254 + - md5: f67e643f6442243cd1e03fa06c197a70 + mtime: 1661498175 + name: clapper.changes + size: 4979 + - md5: ded2042fd0ead479cdfda4b06ade142c + mtime: 1661498175 + name: clapper.spec + size: 3853 + files_hash: d1ec7172b6fbcfbb7dbde2f8892e6b5e + package: clapper + project: multimedia:apps + request: + creator: iznogood + number: 999354 + source_package: clapper + source_project: multimedia:apps + source_rev: 3da0f4e851d0205f21bfc12cfd23c24c + state: accepted + type: submit + rev: 10.0 + unexpanded_srcmd5: de98dbb2763030b2d386e75fb6d437a2 + userid: buildservice-autocommit +- broken: false + comment: New package + commit_time: 2022-02-27 22:42:56 + expanded_srcmd5: d9c86e4f705c838e19b218f0f855c506 + files: + - md5: e6c61dadeb7745c09d9ae1f7225a4e20 + mtime: 1640080764 + name: clapper-0.4.1.tar.gz + size: 189352 + - md5: cb6cc341db07e6c7c594991e98e5ff4e + mtime: 1645873920 + name: clapper.changes + size: 3465 + - md5: 8b31c5a7b11ce5df77a054aa5889455c + mtime: 1645874684 + name: clapper.spec + size: 3216 + files_hash: 57b82960f963280f9b63a0c08533bd40 + package: clapper + project: openSUSE:Factory + request: + creator: iznogood + number: 957803 + source_package: clapper + source_project: multimedia:apps + source_rev: d9c86e4f705c838e19b218f0f855c506 + state: accepted + type: submit + rev: 1.0 + unexpanded_srcmd5: d9c86e4f705c838e19b218f0f855c506 + userid: dimstar_suse +- broken: false + comment: "- Update to version 0.5.1:\n * A quick hotfix release. Fixes problems\ + \ with new video sink on\n displays with non-100% scaling applied.\n- Changes\ + \ from version 0.5.0:\n * Clapper now includes an all new and improved GStreamer\ + \ video\n sink. With it, we are moving away from GLArea into using\n GdkPaintable.\ + \ This already gives us slight performance\n improvement in some cases and\ + \ opens new possibilities to\n improve it further at a later time. New sink\ + \ now also handles\n overlaying and displaying subtitles on the GTK side of\ + \ things\n (as a separate GdkTextures instead of drawing them into\n framebuffer).\ + \ Old, now called \"legacy\" sink is still included.\n If there are any problems\ + \ with the new one, you can set\n CLAPPER_USE_LEGACY_SINK=1 env to use the\ + \ old one.\n * Networking was ported into libsoup3. The built-in, unfinished\n\ + \ web application was removed.\n * Additionally, app now supports D-Bus launching\n\ + \ (DBusActivatable).\n * Some other misc fixes and few small UI changes were\ + \ also done.\n * Updated translations.\n- Update libnames define to align with\ + \ soname.\n" + commit_time: 2022-06-20 15:38:39 + expanded_srcmd5: 1a088c2521344c27d92a83c6d5664df3 + files: + - md5: 4b17fee0a0c0c7e4e17342060423fd6b + mtime: 1653827577 + name: clapper-0.5.1.tar.gz + size: 205892 + - md5: f38d8401e908e50cc59ddcdc4cdca2b7 + mtime: 1655288124 + name: clapper.changes + size: 4698 + - md5: ce1300968ea115c15788342685fd72c9 + mtime: 1655730696 + name: clapper.spec + size: 3853 + files_hash: 0f6ed5f9ce80048e6f356a93cceda5f7 + package: clapper + project: openSUSE:Factory + request: + creator: iznogood + number: 983983 + source_package: clapper + source_project: multimedia:apps + source_rev: 179be2df4942f26148a025952b88f03d + state: accepted + type: submit + rev: 2.0 + unexpanded_srcmd5: 1a088c2521344c27d92a83c6d5664df3 + userid: dimstar_suse +- broken: false + comment: '' + commit_time: 2022-08-27 11:49:46 + expanded_srcmd5: 07cc3d5c70b4e714f38b65feea22d059 + files: + - md5: e8d358ab1f56e738656220a652af978a + mtime: 1656076496 + name: clapper-0.5.2.tar.gz + size: 207254 + - md5: f67e643f6442243cd1e03fa06c197a70 + mtime: 1661498175 + name: clapper.changes + size: 4979 + - md5: ded2042fd0ead479cdfda4b06ade142c + mtime: 1661498175 + name: clapper.spec + size: 3853 + files_hash: d1ec7172b6fbcfbb7dbde2f8892e6b5e + package: clapper + project: openSUSE:Factory + request: + creator: iznogood + number: 999354 + source_package: clapper + source_project: multimedia:apps + source_rev: 3da0f4e851d0205f21bfc12cfd23c24c + state: accepted + type: submit + rev: 3.0 + unexpanded_srcmd5: 07cc3d5c70b4e714f38b65feea22d059 + userid: dimstar_suse diff --git a/tests/fixtures/clapper-expected-tree.yaml b/tests/fixtures/clapper-expected-tree.yaml new file mode 100644 index 0000000..494c0f7 --- /dev/null +++ b/tests/fixtures/clapper-expected-tree.yaml @@ -0,0 +1,7 @@ +- commit: Rev openSUSE:Factory/clapper/3.0 + merged: + - Rev multimedia:apps/clapper/9.0 +- commit: Rev openSUSE:Factory/clapper/2.0 + merged: + - Rev multimedia:apps/clapper/7.0 +- commit: Rev openSUSE:Factory/clapper/1.0 diff --git a/tests/tree_test.py b/tests/tree_test.py index 27febe5..dc40c53 100644 --- a/tests/tree_test.py +++ b/tests/tree_test.py @@ -11,25 +11,33 @@ from lib.tree_builder import TreeBuilder class TestTreeMethods(unittest.TestCase): def setUp(self): self.db = DB(section="test") - path = os.path.join(os.path.dirname(__file__), "fixtures/zsh-data.yaml") + + def verify_package(self, package): + path = os.path.join(os.path.dirname(__file__), f"fixtures/{package}-data.yaml") with open(path, "r") as f: - zsh_data = yaml.safe_load(f) - for rev in zsh_data["revisions"]: + data = yaml.safe_load(f) + for rev in data["revisions"]: DBRevision.import_fixture_dict(self.db, rev) - def test_create_tree(self): - revisions = TreeBuilder(self.db).build("zsh") - - if False: - import sys - - yaml.dump(revisions.as_list(), sys.stdout) + revisions = TreeBuilder(self.db).build(package) path = os.path.join( - os.path.dirname(__file__), "fixtures/zsh-expected-tree.yaml" + os.path.dirname(__file__), f"fixtures/{package}-expected-tree.yaml" ) + # REGENERATE_DATA=1 PYTHONPATH=$PWD python3 ./tests/tree_test.py + if os.getenv("REGENERATE_DATA"): + with open(path, "w") as f: + yaml.dump(revisions.as_list(), f) + with open(path, "r") as f: - zsh_data = yaml.safe_load(f) - self.assertEqual(zsh_data, revisions.as_list()) + data = yaml.safe_load(f) + self.assertEqual(data, revisions.as_list()) + self.db.conn.rollback() + + def test_zsh_tree(self): + self.verify_package("zsh") + + def test_clapper_tree(self): + self.verify_package("clapper") if __name__ == "__main__":