Skip to content

Commit

Permalink
Only run example tests on Linux, since many require cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
eliben committed Oct 29, 2021
1 parent 43997f1 commit 268067b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
5 changes: 0 additions & 5 deletions examples/func_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

from pycparser import c_ast, parse_file


# A visitor with some state information (the funcname it's looking for)
class FuncCallVisitor(c_ast.NodeVisitor):
def __init__(self, funcname):
Expand All @@ -31,10 +30,6 @@ def visit_FuncCall(self, node):
self.visit(node.args)


def cpp_supported():
return platform.system() == 'Linux'


def show_func_calls(filename, funcname):
ast = parse_file(filename, use_cpp=True)
v = FuncCallVisitor(funcname)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
import unittest

sys.path.insert(0, '.')
from tests.test_util import run_exe
from tests.test_util import run_exe, cpp_supported

EMIT_ELAPSED_TIME = False

# Runs all pycparser examples with no command-line arguments and makes sure they
# run successfully (return code = 0), without actually verifying their output.
class TestExamplesSucceed(unittest.TestCase):
@unittest.skipUnless(cpp_supported(), 'cpp only works on Unix')
def test_all_examples(self):
root = './examples'
for filename in os.listdir(root):
Expand Down

0 comments on commit 268067b

Please sign in to comment.