From 268067bb6dcdb816010ae2dbc2c5edc9e260c59d Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Fri, 29 Oct 2021 10:03:20 -0700 Subject: Only run example tests on Linux, since many require cpp --- examples/func_calls.py | 5 ----- tests/test_examples.py | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/func_calls.py b/examples/func_calls.py index ce70232..d72bd8f 100644 --- a/examples/func_calls.py +++ b/examples/func_calls.py @@ -17,7 +17,6 @@ sys.path.extend(['.', '..']) 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): @@ -31,10 +30,6 @@ class FuncCallVisitor(c_ast.NodeVisitor): 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) diff --git a/tests/test_examples.py b/tests/test_examples.py index 24cf16e..3c516e1 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -4,13 +4,14 @@ import time 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): -- cgit v1.2.1