Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

handle 'cpp' tag in end-to-end srctree tests

  • Loading branch information...
commit 1a0ff5e2e0cc78f07f059db10ecd79db036186d8 1 parent b1bef0a
scoder authored July 29, 2012
8  Cython/TestUtils.py
@@ -172,8 +172,10 @@ def unpack_source_tree(tree_file, dir=None):
172 172
     header = []
173 173
     cur_file = None
174 174
     f = open(tree_file)
175  
-    lines = f.readlines()
176  
-    f.close()
  175
+    try:
  176
+        lines = f.readlines()
  177
+    finally:
  178
+        f.close()
177 179
     f = None
178 180
     for line in lines:
179 181
         if line[:5] == '#####':
@@ -186,7 +188,7 @@ def unpack_source_tree(tree_file, dir=None):
186 188
             cur_file = open(path, 'w')
187 189
         elif cur_file is not None:
188 190
             cur_file.write(line)
189  
-        else:
  191
+        elif line.strip() and not line.lstrip().startswith('#'):
190 192
             header.append(line)
191 193
     if cur_file is not None:
192 194
         cur_file.close()
3  runtests.py
@@ -376,7 +376,8 @@ def handle_directory(self, path, context):
376 376
                 mode = 'pyregr'
377 377
 
378 378
             if ext == '.srctree':
379  
-                suite.addTest(EndToEndTest(filepath, workdir, self.cleanup_workdir))
  379
+                if 'cpp' not in tags['tag'] or 'cpp' in self.languages:
  380
+                    suite.addTest(EndToEndTest(filepath, workdir, self.cleanup_workdir))
380 381
                 continue
381 382
 
382 383
             # Choose the test suite.
2  tests/build/cpp_cythonize.srctree
... ...
@@ -1,3 +1,5 @@
  1
+# tag: cpp
  2
+
1 3
 PYTHON setup.py build_ext --inplace
2 4
 PYTHON -c "import a; a.use_vector([1,2,3])"
3 5
 
2  tests/build/inline_distutils.srctree
... ...
@@ -1,3 +1,5 @@
  1
+# tag: cpp
  2
+
1 3
 PYTHON setup.py build_ext --inplace
2 4
 PYTHON -c "import a"
3 5
 
2  tests/build/module_api.srctree
... ...
@@ -1,3 +1,5 @@
  1
+# tag: cpp
  2
+
1 3
 PYTHON setup.py build_ext --inplace
2 4
 PYTHON test.py
3 5
 

0 notes on commit 1a0ff5e

Please sign in to comment.
Something went wrong with that request. Please try again.