diff --git a/tests/ctypesgentest.py b/tests/ctypesgentest.py index e44eee3a..d927b00a 100644 --- a/tests/ctypesgentest.py +++ b/tests/ctypesgentest.py @@ -35,7 +35,7 @@ def generate(header_str, args=[], lang="py"): tmp_header = tempfile.NamedTemporaryFile() tmp_header.write(header_str.encode()) tmp_header.seek(0) - tmp_out = tempfile.NamedTemporaryFile() + tmp_out = tempfile.NamedTemporaryFile(mode="w") ctypesgen_main(["-i", tmp_header.name, "-o", tmp_out.name, "--output-language", lang, *args]) tmp_header_name = tmp_header.name diff --git a/tests/testsuite.py b/tests/testsuite.py index b1d3309d..a82a7c17 100755 --- a/tests/testsuite.py +++ b/tests/testsuite.py @@ -2550,7 +2550,7 @@ class MacromanEncodeTest(unittest.TestCase): @classmethod def setUpClass(cls): - cls.mac_roman_file = "temp_mac.h" + cls.mac_roman_file = TEST_DIR/"temp_mac.h" mac_header_str = b""" #define kICHelper "\xa9\\pHelper\xa5" @@ -2559,8 +2559,8 @@ def setUpClass(cls): with open(cls.mac_roman_file, "wb") as mac_file: mac_file.write(mac_header_str) - header_str = """ - #include "temp_mac.h" + header_str = f""" + #include "{cls.mac_roman_file}" #define MYSTRING kICHelper