From a083266479ac7b3023cb4dd2d19e27e5ac4b565c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fridrich=20=C5=A0trba?= Date: Fri, 11 Aug 2023 12:25:10 +0200 Subject: [PATCH 3/3] Allow running tests with python 3.4 --- test/python/file_load_common.py | 6 +++--- test/python/test_module.py | 4 ++-- test/python/test_ods.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/python/file_load_common.py b/test/python/file_load_common.py index 55874050..934ce2a8 100644 --- a/test/python/file_load_common.py +++ b/test/python/file_load_common.py @@ -202,14 +202,14 @@ def run_test_dir(self, test_dir, doc_loader): """ print("test directory: {}".format(test_dir)) - expected = ExpectedDocument(os.path.join(test_dir, "check.txt")) + expected = ExpectedDocument(os.path.join(str(test_dir), "check.txt")) # Find the input file to load. input_file = None - for file_name in os.listdir(test_dir): + for file_name in os.listdir(str(test_dir)): name, ext = os.path.splitext(file_name) if name == "input": - input_file = os.path.join(test_dir, file_name) + input_file = os.path.join(str(test_dir), file_name) break print("input file: {}".format(input_file)) diff --git a/test/python/test_module.py b/test/python/test_module.py index 2d6ca4be..ccfbb6c6 100755 --- a/test/python/test_module.py +++ b/test/python/test_module.py @@ -20,12 +20,12 @@ class ModuleTest(unittest.TestCase): @classmethod def setUpClass(cls): top_builddir = Path(os.environ["BUILDDIR"]) - with open(top_builddir / "test" / "python" / "env.json", "r") as f: + with open(str(top_builddir / "test" / "python" / "env.json"), "r") as f: cls.env = json.load(f) def test_version(self): s = orcus.__version__ - expected = f"{self.env['version-major']}.{self.env['version-minor']}.{self.env['version-micro']}" + expected = "{}.{}.{}".format(self.env['version-major'], self.env['version-minor'], self.env['version-micro']) self.assertEqual(expected, s) def test_detect_format(self): diff --git a/test/python/test_ods.py b/test/python/test_ods.py index e4c0dc97..29ab10a8 100755 --- a/test/python/test_ods.py +++ b/test/python/test_ods.py @@ -31,7 +31,7 @@ class TestCase(unittest.TestCase): def test_formula_tokens_1(self): filepath = self.basedir / "formula-1" / "input.ods" - with open(filepath, "rb") as f: + with open(str(filepath), "rb") as f: doc = ods.read(f, recalc=False) self.assertEqual(len(doc.sheets), 1) @@ -82,7 +82,7 @@ class TestCase(unittest.TestCase): def test_formula_tokens_2(self): filepath = self.basedir / "formula-2" / "input.ods" - with open(filepath, "rb") as f: + with open(str(filepath), "rb") as f: doc = ods.read(f, recalc=False) self.assertEqual(len(doc.sheets), 1) -- 2.41.0