Skip to content

Commit

Permalink
Make test case more portable
Browse files Browse the repository at this point in the history
  • Loading branch information
mara004 committed Jan 23, 2025
1 parent 72e8cd8 commit 5b84129
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
7 changes: 5 additions & 2 deletions tests/testsuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import math
import unittest
import subprocess
from pathlib import Path
from contextlib import (
redirect_stdout,
redirect_stderr,
Expand All @@ -44,6 +45,7 @@
ctypesgen_wrapper,
module_from_code,
TMP_DIR,
CTYPESGEN_DIR,
CLEANUP_OK,
)
from . import json_expects
Expand Down Expand Up @@ -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"))

0 comments on commit 5b84129

Please sign in to comment.