From fa8efb1b4fa51c281d4507ccccfff24c7c6e1b1f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 15 Oct 2023 22:10:16 +0530 Subject: [PATCH] ... --- src/calibre/test_build.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py index 406448b534..71e6576cd6 100644 --- a/src/calibre/test_build.py +++ b/src/calibre/test_build.py @@ -61,9 +61,11 @@ class BuildTest(unittest.TestCase): ldr = importlib.import_module('calibre').__spec__.loader.get_resource_reader() self.assertIn('ebooks', ldr.contents()) try: - raw = ldr.open_resource('__init__.py').read() + with ldr.open_resource('__init__.py') as f: + raw = f.read() except FileNotFoundError: - raw = ldr.open_resource('__init__.pyc').read() + with ldr.open_resource('__init__.pyc') as f: + raw = f.read() self.assertGreater(len(raw), 1024) def test_regex(self):