dev-python/pygccxml: Fix tests

Closes: https://bugs.gentoo.org/936005
Signed-off-by: Thomas Beierlein <tomjbe@gentoo.org>
This commit is contained in:
Thomas Beierlein
2024-08-26 22:05:26 +02:00
parent 52d6cf923c
commit 221b27ca60
2 changed files with 108 additions and 0 deletions

View File

@@ -0,0 +1,107 @@
diff --git a/unittests/test_cpp_standards.py b/unittests/test_cpp_standards.py
index eb28418..7c76c73 100644
--- a/unittests/test_cpp_standards.py
+++ b/unittests/test_cpp_standards.py
@@ -23,7 +23,8 @@ class Test(parser_test_case.parser_test_case_t):
if "gccxml" in self.config.xml_generator:
return True
- parser.parse(["cpp_standards.hpp"], self.config)
+ parser.parse(["cpp_standards.hpp"], self.config,
+ parser.COMPILATION_MODE.ALL_AT_ONCE)
if platform.system() != 'Windows':
self.config.cflags = "-std=c++98"
@@ -33,7 +34,8 @@ class Test(parser_test_case.parser_test_case_t):
parser.parse(["cpp_standards.hpp"], self.config)
self.config.cflags = "-std=c++11"
- parser.parse(["cpp_standards.hpp"], self.config)
+ parser.parse(["cpp_standards.hpp"], self.config,
+ parser.COMPILATION_MODE.ALL_AT_ONCE)
# This is broken with llvm 3.6.2 (the one from homebrew)
# It should work with never llvms but I keep the test disabled
diff --git a/unittests/test_non_copyable_recursive.py b/unittests/test_non_copyable_recursive.py
index cd78a9a..e18d58f 100644
--- a/unittests/test_non_copyable_recursive.py
+++ b/unittests/test_non_copyable_recursive.py
@@ -27,7 +27,7 @@ class Test(parser_test_case.parser_test_case_t):
RuntimeError: maximum recursion depth exceeded while
calling a Python object
"""
- decls = parser.parse([self.header], self.config)
+ decls = parser.parse([self.header], self.config, parser.COMPILATION_MODE.ALL_AT_ONCE)
global_ns = declarations.get_global_namespace(decls)
# Description of the problem (before the fix):
@@ -52,7 +52,7 @@ class Test(parser_test_case.parser_test_case_t):
RuntimeError: maximum recursion depth exceeded while
calling a Python object
"""
- decls = parser.parse([self.header], self.config)
+ decls = parser.parse([self.header], self.config, parser.COMPILATION_MODE.ALL_AT_ONCE)
global_ns = declarations.get_global_namespace(decls)
# Real life example of the bug. This leads to a similar error,
diff --git a/unittests/test_null_comparison.py b/unittests/test_null_comparison.py
index 51caf4a..787ae79 100644
--- a/unittests/test_null_comparison.py
+++ b/unittests/test_null_comparison.py
@@ -22,7 +22,7 @@ class Test(parser_test_case.parser_test_case_t):
Test for None comparisons with default arguments
"""
- decls = parser.parse([self.header], self.config)
+ decls = parser.parse([self.header], self.config, parser.COMPILATION_MODE.ALL_AT_ONCE)
global_ns = declarations.get_global_namespace(decls)
ns = global_ns.namespace("ns")
diff --git a/unittests/test_overrides.py b/unittests/test_overrides.py
index 9204efc..5ac1b25 100644
--- a/unittests/test_overrides.py
+++ b/unittests/test_overrides.py
@@ -23,7 +23,7 @@ class Test(parser_test_case.parser_test_case_t):
def setUp(self):
if not self.global_ns:
- decls = parser.parse([self.header], self.config)
+ decls = parser.parse([self.header], self.config, parser.COMPILATION_MODE.ALL_AT_ONCE)
Test.global_ns = declarations.get_global_namespace(decls)
Test.xml_generator_from_xml_file = \
self.config.xml_generator_from_xml_file
diff --git a/unittests/test_pattern_parser.py b/unittests/test_pattern_parser.py
index 00a6805..4882c26 100644
--- a/unittests/test_pattern_parser.py
+++ b/unittests/test_pattern_parser.py
@@ -27,7 +27,7 @@ class Test(parser_test_case.parser_test_case_t):
if self.config.xml_generator == "gccxml":
return
- decls = parser.parse([self.header], self.config)
+ decls = parser.parse([self.header], self.config, parser.COMPILATION_MODE.ALL_AT_ONCE)
for decl in declarations.make_flatten(decls):
if "myClass" in decl.name:
@@ -44,7 +44,7 @@ class Test(parser_test_case.parser_test_case_t):
if self.config.xml_generator == "gccxml":
return
- decls = parser.parse([self.header], self.config)
+ decls = parser.parse([self.header], self.config, parser.COMPILATION_MODE.ALL_AT_ONCE)
global_ns = declarations.get_global_namespace(decls)
criteria = declarations.declaration_matcher(name="myClass")
_ = declarations.matcher.find(criteria, global_ns)
diff --git a/unittests/test_smart_pointer.py b/unittests/test_smart_pointer.py
index e9183b7..4a85860 100644
--- a/unittests/test_smart_pointer.py
+++ b/unittests/test_smart_pointer.py
@@ -22,7 +22,7 @@ class Test(parser_test_case.parser_test_case_t):
def setUp(self):
if self.config.xml_generator == "gccxml":
return
- decls = parser.parse([self.header], self.config)
+ decls = parser.parse([self.header], self.config, parser.COMPILATION_MODE.ALL_AT_ONCE)
self.global_ns = declarations.get_global_namespace(decls)
def test_is_smart_pointer(self):

View File

@@ -40,6 +40,7 @@ EPYTEST_DESELECT=(
python_prepare_all() {
local PATCHES=(
"${FILESDIR}/${PN}-2.5.0-fix-tests.patch"
"${FILESDIR}/${PN}-2.4.0-doc.patch"
# https://github.com/CastXML/pygccxml/pull/179
"${FILESDIR}/${P}-which.patch"