Skip to content

Commit 02bef91

Browse files
author
roman_yakovenko
committed
small unittest fixes
1 parent 221e3de commit 02bef91

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

unittests/autoconfig.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@ class cxx_parsers_cfg:
5252
if sys.platform == 'win32':
5353
from pygccxml.msvc import pdb
5454
pdb_file = os.path.join( data_directory, 'msvc_build', 'Debug', 'msvc_build.pdb' )
55-
pdb_loader = pdb.decl_loader_t( pdb_file )
56-
pdb_loader.read()
55+
if os.path.exists( pdb_file ):
56+
pdb_loader = pdb.decl_loader_t( pdb_file )
57+
pdb_loader.read()
5758

5859
def get_pdb_global_ns():
59-
return cxx_parsers_cfg.pdb_loader.global_ns
60+
if cxx_parsers_cfg.pdb_loader:
61+
return cxx_parsers_cfg.pdb_loader.global_ns
6062

6163
#~ try:
6264
#~ import pydsc

unittests/core_tester.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
from pygccxml.parser import *
1818
from pygccxml.declarations import *
1919

20+
def is_sub_path( root, some_path ):
21+
root = normalize_path( root )
22+
some_path = normalize_path( some_path )
23+
return some_path.startswith( root )
24+
25+
2026
class core_t( parser_test_case.parser_test_case_t ):
2127
"""Tests core algorithms of GCC-XML and GCC-XML file reader.
2228
Those most white-box testing.
@@ -68,7 +74,7 @@ def test_nss_join(self):
6874

6975
def _test_ns_membership(self, ns, enum_name ):
7076
unnamed_enum = ns.enum( lambda d: d.name == '' \
71-
and d.location.file_name.startswith( autoconfig.data_directory )
77+
and is_sub_path( autoconfig.data_directory, d.location.file_name )
7278
, recursive=False )
7379
self.failUnless( unnamed_enum in ns.declarations
7480
, "namespace '%s' does not contains unnamed enum." % ns.name )

0 commit comments

Comments
 (0)