summaryrefslogtreecommitdiff
path: root/tests/test_general.py
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2017-04-21 15:53:45 -0700
committerEli Bendersky <eliben@google.com>2017-04-21 15:53:45 -0700
commit4330be3eac7454685c64a2c8bb475927c86f3488 (patch)
treed7d90f2580bee3e17f9870d13176d279b26ea016 /tests/test_general.py
parent92ae9ebf98cc855e0d64b93647b61402ea067b0f (diff)
downloadpycparser-4330be3eac7454685c64a2c8bb475927c86f3488.tar.gz
Conditinally skipping cpp-using tests unless platform is Linux
Diffstat (limited to 'tests/test_general.py')
-rw-r--r--tests/test_general.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/test_general.py b/tests/test_general.py
index 2c661d7..e5e9d69 100644
--- a/tests/test_general.py
+++ b/tests/test_general.py
@@ -1,4 +1,6 @@
-import sys, os
+import os
+import platform
+import sys
import unittest
sys.path.insert(0, '..')
@@ -23,6 +25,8 @@ class TestParsing(unittest.TestCase):
ast = parse_file(self._find_file('example_c_file.c'))
self.assertTrue(isinstance(ast, c_ast.FileAST))
+ @unittest.skipUnless(platform.system() == 'Linux',
+ 'cpp only works on Linux')
def test_with_cpp(self):
memmgr_path = self._find_file('memmgr.c')
c_files_path = os.path.dirname(memmgr_path)
@@ -39,6 +43,8 @@ class TestParsing(unittest.TestCase):
self.assertTrue(isinstance(ast2, c_ast.FileAST))
+ @unittest.skipUnless(platform.system() == 'Linux',
+ 'cpp only works on Linux')
def test_cpp_funkydir(self):
# This test contains Windows specific path escapes
if sys.platform != 'win32':
@@ -49,6 +55,8 @@ class TestParsing(unittest.TestCase):
cpp_path=CPPPATH, cpp_args='-I%s' % c_files_path)
self.assertTrue(isinstance(ast, c_ast.FileAST))
+ @unittest.skipUnless(platform.system() == 'Linux',
+ 'cpp only works on Linux')
def test_no_real_content_after_cpp(self):
ast = parse_file(self._find_file('empty.h'), use_cpp=True,
cpp_path=CPPPATH)