Commits

Anonymous committed f516b59

nightly commit

Comments (0)

Files changed (9)

 
             try:
                 for i, sig in enumerate([SIGTERM, SIGKILL] * 2):
-                    if i % 2 == 0:  os.kill(self.pid, sig)
-                    else:           time.sleep((i+1)/10.0)
+                    if i % 2 == 0: os.kill(self.pid, sig)
+                    time.sleep((i * (i % 2) / 5.0)  + 0.01)
 
                     killed_pid, stat = os.waitpid(self.pid, os.WNOHANG)
-
                     # print (i, killed_pid, stat)
 
                     if killed_pid != 0: return True  # ???
 os.chdir(main_dir)
 
 test_modules = []
-for f in os.listdir(test_subdir):
+for f in sorted(os.listdir(test_subdir)):
     for match in TEST_MODULE_RE.findall(f):
         test_modules.append(match)
 
 
 import async_sub
 
-def run_test(cmd):
-    module = os.path.basename(cmd).split('.')[0]
+def run_test(args):
+    module, cmd = args
     print 'loading %s' % module
     ret_code, response = async_sub.proc_in_time_or_kill (
         cmd, time_out = options.time_out
 # Run all the tests in subprocesses
 #
 
-test_cmd = ('%s %s/' % (options.python, test_subdir)) + '%s.py'
-# test_cmd += flags and options to pass on
+flags = []
+test_cmds = [ 
+    (m, [options.python, os.path.join(test_subdir, '%s.py' % m)] + flags)
+        for m in test_modules if  m not in SUBPROCESS_IGNORE 
+]
 
-test_cmds = [ test_cmd % m for m in test_modules if 
-                         m not in SUBPROCESS_IGNORE ]
 
 t = time.time()
 

test/run_tests__tests/print_stderr/fake_2_test.py

+import unittest
+
+class KeyModuleTest(unittest.TestCase):
+    def test_get_focused(self):
+        self.assert_(True) 
+
+    def test_get_mods(self):
+        self.assert_(True) 
+
+    def test_get_pressed(self):
+        self.assert_(True) 
+
+    def test_name(self):
+        self.assert_(True) 
+
+    def test_set_mods(self):
+        self.assert_(True) 
+
+    def test_set_repeat(self):
+        self.assert_(True) 
+
+if __name__ == '__main__':
+    unittest.main()

test/run_tests__tests/print_stderr/fake_3_test.py

+import unittest, sys
+
+class KeyModuleTest(unittest.TestCase):
+    def test_get_focused(self):
+        self.assert_(True) 
+
+    def test_get_mods(self):
+        self.assert_(True) 
+
+    def test_get_pressed(self):
+        self.assert_(True) 
+
+    def test_name(self):
+        print >> sys.stderr, 'jibberish messes things up'
+        self.assert_(False) 
+
+    def test_set_mods(self):
+        self.assert_(True) 
+
+    def test_set_repeat(self):
+        self.assert_(True) 
+
+if __name__ == '__main__':
+    unittest.main()

test/run_tests__tests/print_stderr/fake_4_test.py

+import unittest
+
+class KeyModuleTest(unittest.TestCase):
+    def test_get_focused(self):
+        self.assert_(True) 
+
+    def test_get_mods(self):
+        self.assert_(True) 
+
+    def test_get_pressed(self):
+        self.assert_(False, "Some Jibberish") 
+
+    def test_name(self):
+        self.assert_(True) 
+
+    def test_set_mods(self):
+        if 1:
+            if 1:
+                assert False 
+
+    def test_set_repeat(self):
+        self.assert_(True) 
+
+if __name__ == '__main__':
+    unittest.main()

test/run_tests__tests/print_stdout/fake_2_test.py

+import unittest
+
+class KeyModuleTest(unittest.TestCase):
+    def test_get_focused(self):
+        self.assert_(True) 
+
+    def test_get_mods(self):
+        self.assert_(True) 
+
+    def test_get_pressed(self):
+        self.assert_(True) 
+
+    def test_name(self):
+        self.assert_(True) 
+
+    def test_set_mods(self):
+        self.assert_(True) 
+
+    def test_set_repeat(self):
+        self.assert_(True) 
+
+if __name__ == '__main__':
+    unittest.main()

test/run_tests__tests/print_stdout/fake_3_test.py

+import unittest, sys
+
+class KeyModuleTest(unittest.TestCase):
+    def test_get_focused(self):
+        self.assert_(True) 
+
+    def test_get_mods(self):
+        self.assert_(True) 
+
+    def test_get_pressed(self):
+        self.assert_(True) 
+
+    def test_name(self):
+        print 'jibberish messes things up'
+        self.assert_(False) 
+
+    def test_set_mods(self):
+        self.assert_(True) 
+
+    def test_set_repeat(self):
+        self.assert_(True) 
+
+if __name__ == '__main__':
+    unittest.main()

test/run_tests__tests/print_stdout/fake_4_test.py

+import unittest
+
+class KeyModuleTest(unittest.TestCase):
+    def test_get_focused(self):
+        self.assert_(True) 
+
+    def test_get_mods(self):
+        self.assert_(True) 
+
+    def test_get_pressed(self):
+        self.assert_(False, "Some Jibberish") 
+
+    def test_name(self):
+        self.assert_(True) 
+
+    def test_set_mods(self):
+        if 1:
+            if 1:
+                assert False 
+
+    def test_set_repeat(self):
+        self.assert_(True) 
+
+if __name__ == '__main__':
+    unittest.main()

test/run_tests__tests/run_tests__test.py

 )
 NORMALIZERS = (
     (r"Ran (\d+) tests in (\d+\.\d+)s",   "Ran \\1 tests in X.XXXs" ),
-    (r'File ".*?([^/\\.]+\.py)"',         'File "\\1"')  
+    (r'File ".*?([^/\\.]+\.py)"',         'File "\\1"'),
+
     #TODO: look into why os.path.sep differs
 )
 
     
     return result
 
-def call_proc(cmd):
+def call_proc(cmd, cd=None):
     proc = subprocess.Popen (
-        cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+        cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd = cd,
+	universal_newlines = True,
     )
     assert not proc.wait()
-    return proc.stdout.read()
+    return proc.stdout.read() + proc.stderr.read()
 
 ################################################################################
 
 # Test that output is the same in single process and subprocess modes 
 #
 
-single_cmd = "%s run_tests.py -f %s"
-subprocess_cmd = single_cmd + ' -s'
+cmd = [sys.executable, 'run_tests.py', '-f']
+sub_cmd = [sys.executable, 'run_tests.py', '-s', '-f']
+
+time_out_cmd = [
+    sys.executable, 'run_tests.py', '-t', '4', '-s', '-f', 'infinite_loop',
+]
 
 passes = 0
 failed = False
 
-os.chdir(trunk_dir)
 for suite in test_suite_dirs:
-    single = call_proc(single_cmd % (sys.executable, suite))
-    subs = call_proc(subprocess_cmd % (sys.executable, suite))
+    single = call_proc(cmd + [suite], trunk_dir)
+    subs = call_proc(sub_cmd + [suite], trunk_dir)
 
     normed_single, normed_subs = map(norm_result,(single, subs))
 
             ))
         )
 
-
 print "infinite_loop suite (subprocess mode timeout)",
-loop_cmd = subprocess_cmd + ' -t 2'
-loop_test = call_proc(loop_cmd % (sys.executable, "infinite_loop"))
+loop_test = call_proc(time_out_cmd, trunk_dir)
 passes += 1
 print "OK"
 
 
 print "\n-h for help"
 
-################################################################################
+################################################################################