Mercurial > hgrepos > Python > apps > py-cutils
changeset 383:e949cab90e86
treesum: FIX: do not include generated .treesum-files when testing.
While there: use "path:" instead of "glob:" when excluding the temporary test directory
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sat, 17 May 2025 15:13:45 +0200 |
| parents | dd0bc31064e4 |
| children | f66afecac253 |
| files | tests/test_treesum.py |
| diffstat | 1 files changed, 16 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test_treesum.py Sat May 17 13:32:39 2025 +0200 +++ b/tests/test_treesum.py Sat May 17 15:13:45 2025 +0200 @@ -37,7 +37,8 @@ gen_opts = cutils.treesum.gen_generate_opts( directories=[DATADIR], algorithm="SHA1", - fnmatch_filters=[("exclude", "glob:%s" % (rel_tmpdir,))], + fnmatch_filters=[("exclude", "path:%s" % (rel_tmpdir,)), + ("exclude", "glob:*.treesum")], generator="full", grouping_separator="_", output=digest_file, @@ -50,9 +51,9 @@ cutils.treesum.print_treesum_digestfile_infos(info_opts) info = cutils.treesum.TreesumInfo.collect_last_from_file(digest_file) self.assertEqual( - b"\xe1\x76\x18\xfc\x9b\x2f\x1e\x41\xfc\xe0\x04\xfc\x92\x43\x4e\xa7\x49\xbd\x57\x36", # noqa: E501 line too long + b"\xcb\x04\x39\x44\x60\x08\xd7\xfa\x0a\x25\xfd\xc6\xbb\x74\x8e\x2c\x12\x13\xf8\x31", # noqa: E501 line too long info.digest) - self.assertEqual(2808, info.size) + self.assertEqual(55, info.size) self.assertEqual("SHA1", info.algorithm) def test_gen_and_info_P_native(self): @@ -63,7 +64,8 @@ gen_opts = cutils.treesum.gen_generate_opts( directories=[DATADIR], algorithm="SHA1", - fnmatch_filters=[("exclude", "glob:%s" % (rel_tmpdir,))], + fnmatch_filters=[("exclude", "path:%s" % (rel_tmpdir,)), + ("exclude", "glob:*.treesum")], generator="full", grouping_separator="_", output=digest_file, @@ -76,9 +78,9 @@ cutils.treesum.print_treesum_digestfile_infos(info_opts) info = cutils.treesum.TreesumInfo.collect_last_from_file(digest_file) self.assertEqual( - b"\xe1\x76\x18\xfc\x9b\x2f\x1e\x41\xfc\xe0\x04\xfc\x92\x43\x4e\xa7\x49\xbd\x57\x36", # noqa: E501 line too long + b"\xcb\x04\x39\x44\x60\x08\xd7\xfa\x0a\x25\xfd\xc6\xbb\x74\x8e\x2c\x12\x13\xf8\x31", # noqa: E501 line too long info.digest) - self.assertEqual(2808, info.size) + self.assertEqual(55, info.size) self.assertEqual("SHA1", info.algorithm) def test_gen_and_info_L_utf8(self): @@ -89,7 +91,8 @@ gen_opts = cutils.treesum.gen_generate_opts( directories=[DATADIR], algorithm="SHA1", - fnmatch_filters=[("exclude", "glob:%s" % (rel_tmpdir,))], + fnmatch_filters=[("exclude", "path:%s" % (rel_tmpdir,)), + ("exclude", "glob:*.treesum")], follow_symlinks=cutils.treesum.FollowSymlinkConfig( True, True, True), generator="full", @@ -104,9 +107,9 @@ cutils.treesum.print_treesum_digestfile_infos(info_opts) info = cutils.treesum.TreesumInfo.collect_last_from_file(digest_file) self.assertEqual( - b"\xb3\xdd\x1b\x93\xec\x3a\xa5\xf1\xb1\xc6\xbd\x8c\x1e\xe1\xd5\xcf\x72\x65\x27\x1d", # noqa: E501 line too long + b"\xfe\x21\x4c\xfa\xdc\xc5\x1f\xad\x63\x19\x74\x95\xf5\xb3\x6d\x32\x45\xec\x73\x3e", # noqa: E501 line too long info.digest) - self.assertEqual(2863, info.size) + self.assertEqual(110, info.size) self.assertEqual("SHA1", info.algorithm) def test_gen_and_info_L_native(self): @@ -117,7 +120,8 @@ gen_opts = cutils.treesum.gen_generate_opts( directories=[DATADIR], algorithm="SHA1", - fnmatch_filters=[("exclude", "glob:%s" % (rel_tmpdir,))], + fnmatch_filters=[("exclude", "path:%s" % (rel_tmpdir,)), + ("exclude", "glob:*.treesum")], follow_symlinks=cutils.treesum.FollowSymlinkConfig( True, True, True), generator="full", @@ -132,9 +136,9 @@ cutils.treesum.print_treesum_digestfile_infos(info_opts) info = cutils.treesum.TreesumInfo.collect_last_from_file(digest_file) self.assertEqual( - b"\xb3\xdd\x1b\x93\xec\x3a\xa5\xf1\xb1\xc6\xbd\x8c\x1e\xe1\xd5\xcf\x72\x65\x27\x1d", # noqa: E501 line too long + b"\xfe\x21\x4c\xfa\xdc\xc5\x1f\xad\x63\x19\x74\x95\xf5\xb3\x6d\x32\x45\xec\x73\x3e", # noqa: E501 line too long info.digest) - self.assertEqual(2863, info.size) + self.assertEqual(110, info.size) self.assertEqual("SHA1", info.algorithm)
