8000 Skip the check where "nm" isn't available. · python/cpython@569c57e · GitHub
[go: up one dir, main page]

Skip to content

Commit 569c57e

Browse files
Skip the check where "nm" isn't available.
1 parent cdeb1d9 commit 569c57e

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

Lib/test/test_check_c_globals.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ class ActualChecks(unittest.TestCase):
1111
# XXX Also run the check in "make check".
1212
@unittest.expectedFailure
1313
def test_check_c_globals(self):
14-
main('check', {})
14+
try:
15+
main('check', {})
16+
except NotImplementedError:
17+
raise unittest.SkipTest('not supported on this host')
1518

1619

1720
if __name__ == '__main__':

Lib/test/test_tools/test_c_analyzer/test_c_analyzer_common/test_files.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ def test_relparent(self):
226226
fixpath('z/eggs/ham/file3.c'),
227227
])
228228
self.assertEqual(self.calls, [
229-
('_walk', ('/x/y/z/spam', '.c', _walk_tree)),
230-
('_walk', ('/x/y/z/eggs', '.c', _walk_tree)),
229+
('_walk', (fixpath('/x/y/z/spam'), '.c', _walk_tree)),
230+
('_walk', (fixpath('/x/y/z/eggs'), '.c', _walk_tree)),
231231
])
232232

233233
def test_glob(self):

Lib/test/test_tools/test_c_analyzer/test_c_parser/test_preprocessor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import itertools
22
import textwrap
33
import unittest
4+
import sys
45

56
from ..util import wrapped_arg_combos, StrProxy
67
from .. import tool_imports_for_tests
@@ -181,6 +182,7 @@ def test_directive_whitespace(self):
181182
('_parse_directive', '#define eggs ( a , b ) { a = b ; }'),
182183
)
183184

185+
@unittest.skipIf(sys.platform == 'win32', 'needs fix under Windows')
184186
def test_split_lines(self):
185187
directive = Macro('eggs', ('a', 'b'), '{ a = b; }')
186188
self.parsed = [
@@ -341,6 +343,7 @@ def test_split_blocks(self):
341343
('_parse_directive', '#endif'),
342344
)
343345

346+
@unittest.skipIf(sys.platform == 'win32', 'needs fix under Windows')
344347
def test_basic(self):
345348
directives = [
346349
Include('<stdio.h>'),
@@ -455,6 +458,7 @@ def test_basic(self):
455458
(23, 'print("end");', None, ()),
456459
])
457460

461+
@unittest.skipIf(sys.platform == 'win32', 'needs fix under Windows')
458462
def test_typical(self):
459463
# We use Include/compile.h from commit 66c4f3f38b86. It has
460464
# a good enough mix of code without being too large.

Tools/c-analyzer/c_symbols/binary.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import os.path
23
import shutil
34
import sys
@@ -22,12 +23,17 @@ def iter_symbols(binary=PYTHON, dirnames=None, *,
2223
if not _file_exists(binary):
2324
raise Exception('executable missing (need to build it first?)')
2425

25-
if not find_local_symbol:
26-
yield from _iter_symbols_nm(binary)
27-
else:
26+
if find_local_symbol:
2827
cache = {}
2928
def find_local_symbol(name, *, _find=find_local_symbol):
3029
return _find(name, dirnames, _perfilecache=cache)
30+
else:
31+
find_local_symbol = None
32+
33+
if os.name == 'nt':
34+
# XXX Support this.
35+
raise NotImplementedError
36+
else:
3137
yield from _iter_symbols_nm(binary, find_local_symbol)
3238

3339

@@ -75,6 +81,8 @@ def _iter_symbols_nm(binary, find_local_symbol=None,
7581
_run=util.run_cmd,
7682
):
7783
nm = _which('nm')
84+
if not nm:
85+
raise NotImplementedError
7886
argv = [nm,
7987
'--line-numbers',
8088
binary,

0 commit comments

Comments
 (0)
0