Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test(self):
config = autoconfig.cxx_parsers_cfg.gccxml
code = "struct const_item{ const int values[10]; };"
global_ns = parser.parse_string(code, config)[0]
ci = global_ns.class_('const_item')
if ("CastXML" not in utils.xml_generator or
utils.xml_output_version >= 1.138):
# Prior to version 1.138, CastXML would incorrect create a default
# constructor definition.
# See https://github.com/CastXML/CastXML/issues/55
# Copy constructor, destructor, variable
self.assertEqual(len(ci.declarations), 3)
def __init__(self, *args):
parser_test_case.parser_test_case_t.__init__(self, *args)
self.__fname = 'declarations_for_filtering.hpp'
self.__fpath = declarations.filtering.normalize_path(
os.path.join( autoconfig.data_directory, self.__fname ) )
def __init__(self, *args):
unittest.TestCase.__init__(self, *args)
self.pdb_file = os.path.join( autoconfig.data_directory
, 'msvc_build'
, 'Debug'
, 'msvc_build.pdb' )
def __init__(self, *args):
parser_test_case.parser_test_case_t.__init__(self, *args)
self.header = os.path.join(
autoconfig.data_directory,
'declarations_enums.hpp')
self.cache_file = os.path.join(
autoconfig.data_directory,
'pygccxml.cache')
if os.path.exists(self.cache_file) and os.path.isfile(self.cache_file):
os.remove(self.cache_file)
def setUp(self):
if not self.global_ns:
# Extract the xml file from the bz2 archive
bz2_path = os.path.join(
autoconfig.data_directory,
'ogre.1.7.xml.bz2')
self.xml_path = os.path.join(
autoconfig.data_directory,
'ogre.1.7.xml')
with open(self.xml_path, 'wb') as new_file:
# bz2.BZ2File can not be used in a with statement in python 2.6
bz2_file = bz2.BZ2File(bz2_path, 'rb')
for data in iter(lambda: bz2_file.read(100 * 1024), b''):
new_file.write(data)
bz2_file.close()
reader = parser.source_reader_t(autoconfig.cxx_parsers_cfg.gccxml)
self.global_ns = declarations.get_global_namespace(
reader.read_xml_file(
self.xml_path))
self.global_ns.init_optimizer()
def __init__(self, *args):
parser_test_case.parser_test_case_t.__init__(self, *args)
self.header = os.path.join(
autoconfig.data_directory,
'declarations_calldef.hpp')
self.template = """
//test generated declaration string using gcc(xml) compiler
Test re-oping cache files.
This test is run by file_cache_tester.py in a subprocess.
"""
if "__pypy__" in sys.builtin_module_names:
# This test is broken on travis with pypy3.3-5.2-alpha1
# It is annoying but only the alpha version is working without
# segfaulting, and it is quite old now. Also; this test is due for
# removal because the utils.xml_generator mechanism is being
# deprecated. So this test can just be skipped until it is completely
# removed
return
data = autoconfig.data_directory
# xml_generator has not been set
if utils.xml_generator is not "":
raise Exception
# Try to reopen an old cache file and check if there is an exception
# These old files do not know about the xml generator; a RuntimeError
# should be thrown, asking to regenerate the cache file.
c_file = os.path.join(data, 'old_cache.cache')
error = False
try:
parser.file_cache_t(c_file)
except RuntimeError:
error = True
if error is False:
raise Exception
def __init__(self, *args):
parser_test_case.parser_test_case_t.__init__(self, *args)
self.header = os.path.join(
autoconfig.data_directory,
'declarations_enums.hpp')
self.cache_file = os.path.join(
autoconfig.data_directory,
'pygccxml.cache')
if os.path.exists(self.cache_file) and os.path.isfile(self.cache_file):
os.remove(self.cache_file)
# Copyright 2014-2016 Insight Software Consortium.
# Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
import os
import hotshot
import hotshot.stats
import autoconfig
import test_parser
if __name__ == "__main__":
statistics_file = os.path.join(autoconfig.data_directory, 'profile.stat')
profile = hotshot.Profile(statistics_file)
profile.runcall(test_parser.run_suite)
profile.close()
statistics = hotshot.stats.load(statistics_file)
statistics.strip_dirs()
statistics.sort_stats('time', 'calls')
statistics.print_stats(20)
def __init__(self, *args):
parser_test_case.parser_test_case_t.__init__(self, *args)
self.header = os.path.join(autoconfig.data_directory, 'core_cache.hpp')
self.cache_file = os.path.join(
autoconfig.data_directory,
'pygccxml.cache')
if os.path.exists(self.cache_file) and os.path.isfile(self.cache_file):
os.remove(self.cache_file)