add embedding to the test suite
authorRobert Bradshaw <robertwb@math.washington.edu>
Thu, 29 Oct 2009 05:49:36 +0000 (22:49 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Thu, 29 Oct 2009 05:49:36 +0000 (22:49 -0700)
Demos/embed/Makefile
runtests.py

index 4a5209e19d2424a1b7af3357b1c89124eef39559..dfb0cc91aaa8d44ac01e55f18019f1803f39cdde 100644 (file)
@@ -16,7 +16,7 @@ all: embedded
 
 clean:
        @echo Cleaning Demos/embed
-       @rm -f *~ *.o *.so core core.* *.c embedded
+       @rm -f *~ *.o *.so core core.* *.c embedded test.output
 
 test: clean all
        ./embedded > test.output
index efb4d4216654a53850d45eb5128690a665718f67..ce48632eb3d0882e4c3b2f0be38360bdd103de99 100644 (file)
@@ -127,6 +127,9 @@ class TestBuilder(object):
                     continue
                 suite.addTest(
                     self.handle_directory(path, filename))
+        if sys.platform not in ['win32']:
+            if [1 for selector in self.selectors if selector("embedded")]:
+                suite.addTest(unittest.makeSuite(EmbedTest))
         return suite
 
     def handle_directory(self, path, context):
@@ -555,6 +558,28 @@ def collect_doctests(path, module_prefix, suite, selectors):
                         except ValueError: # no tests
                             pass
 
+# TODO: Support cython_freeze needed here as well.
+# TODO: Windows support.
+
+class EmbedTest(unittest.TestCase):
+    
+    working_dir = "Demos/embed"
+    
+    def setUp(self):
+        self.old_dir = os.getcwd()
+        os.chdir(self.working_dir)
+        os.system("make clean > /dev/null")
+    
+    def tearDown(self):
+        try:
+            os.system("make clean > /dev/null")
+        except:
+            pass
+        os.chdir(self.old_dir)
+        
+    def test_embed(self):
+        self.assert_(os.system("make test > make.output") == 0)
+
 class MissingDependencyExcluder:
     def __init__(self, deps):
         # deps: { module name : matcher func }