diff --git a/tests/conftest.py b/tests/conftest.py index dfef1c6..afa3671 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -13,6 +13,7 @@ TEST_DIR = Path(__file__).resolve().parent +CTYPESGEN_DIR = TEST_DIR.parent COMMON_DIR = TEST_DIR/"common" TMP_DIR = TEST_DIR/"tmp" diff --git a/tests/testsuite.py b/tests/testsuite.py index 8d637a6..78aec3b 100755 --- a/tests/testsuite.py +++ b/tests/testsuite.py @@ -29,6 +29,7 @@ import math import unittest import subprocess +from pathlib import Path from contextlib import ( redirect_stdout, redirect_stderr, @@ -44,6 +45,7 @@ ctypesgen_wrapper, module_from_code, TMP_DIR, + CTYPESGEN_DIR, CLEANUP_OK, ) from . import json_expects @@ -1064,14 +1066,15 @@ def tearDownClass(cls): cls.outpath.unlink() def test_content(self): + # FIXME the double backslash is actually wrong -- maybe we should remove the R-string prefix, as python seems to auto-escape as necessary exp_docstring = R""" Auto-generated by: ctypesgen.api_main( {'library': 'c', - 'output': PosixPath('./tests/tmp/apimain_stdio.py'), + 'output': %s, 'symbol_rules': ['if_needed=__\\w+'], 'system_headers': ['stdio.h']} ) -""" +""" % (repr(self.outpath).replace(str(CTYPESGEN_DIR), "."), ) self.assertEqual(self.module.__doc__, exp_docstring) self.assertTrue(hasattr(self.module, "printf"))