From aebff006731b0ae9f2dfcb4a80d32b6c666b28f3 Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Mar 14 2023 10:08:16 +0000 Subject: unit test: more closely mimic rpm2cpio behavior when reading past header --- diff --git a/tests/test_lib/test_header_sizes.py b/tests/test_lib/test_header_sizes.py index 4d41d56..dc603f8 100644 --- a/tests/test_lib/test_header_sizes.py +++ b/tests/test_lib/test_header_sizes.py @@ -57,10 +57,11 @@ class TestHeaderSizes(unittest.TestCase): # The following bit uses rpmlib to read the header, which advances the file # pointer past it. This is the same approach rpm2cpio uses. + ts = rpm.TransactionSet() + ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES | rpm._RPMVSF_NODIGESTS | rpm.RPMVSF_NOHDRCHK) fd = os.open(fn, os.O_RDONLY) try: - os.lseek(fd, s_lead + s_sig, 0) # seek to header start - hdr, h_start = rpm.readHeaderFromFD(fd) + hdr = ts.hdrFromFdno(fd) p_offset = os.lseek(fd, 0, os.SEEK_CUR) finally: os.close(fd)