Author: Ronny Pfannschmidt <[email protected]>
Branch: refine-testrunner
Changeset: r73783:d37fb439e6b2
Date: 2014-10-05 17:49 +0200
http://bitbucket.org/pypy/pypy/changeset/d37fb439e6b2/

Log:    Fix Tests

diff --git a/testrunner/runner.py b/testrunner/runner.py
--- a/testrunner/runner.py
+++ b/testrunner/runner.py
@@ -4,6 +4,7 @@
 import Queue
 import py
 import util
+import collections
 
 READ_MODE = 'rU'
 WRITE_MODE = 'wb'
@@ -74,13 +75,20 @@
             output = one_output.read(READ_MODE)
         else:
             output = ""
+
         if logfname.check(file=1):
             logdata = logfname.read(READ_MODE)
         else:
             logdata = ""
 
+
+
+
         failure, extralog = util.interpret_exitcode(exitcode, test, logdata)
 
+        junit = logfname + '.junit'
+        if junit.check(file=1):
+            pass
         if extralog:
             logdata += extralog
 
@@ -103,7 +111,7 @@
 
     N = run_param.parallel_runs
     if N > 1:
-        out.write("running %d parallel test workers\n" % N)
+        run_param.log("running %d parallel test workers", N)
     failure = False
 
     for testname in testdirs:
@@ -241,7 +249,7 @@
     else:
         out = open(opts.output, WRITE_MODE)
 
-    testdirs = []
+    testdirs = deque()
 
     run_param = RunParamClass.from_options(opts, out)
     # the config files are python files whose run overrides the content
@@ -251,7 +259,7 @@
     for config_py_file in opts.config:
         config_py_file = renamed_configs.get(config_py_file, config_py_file)
         config_py_file = os.path.expanduser(config_py_file)
-        if py.path.local(config_py_file).check(file=1):
+        if os.path.isfile(config_py_file):
             run_param.log("using config %s", config_py_file)
             execfile(config_py_file, run_param.__dict__)
         else:
diff --git a/testrunner/test/test_runner.py b/testrunner/test/test_runner.py
--- a/testrunner/test/test_runner.py
+++ b/testrunner/test/test_runner.py
@@ -98,14 +98,14 @@
         cls.real_invoke_in_thread = (runner.invoke_in_thread,)
         if not cls.with_thread:
             runner.invoke_in_thread = lambda func, args: func(*args)
-        
+
         cls.udir = py.path.local.make_numbered_dir(prefix='usession-runner-',
                                               keep=3)
         cls.manydir = cls.udir.join('many').ensure(dir=1)
 
         cls.udir.join("conftest.py").write("pytest_plugins = 'resultlog'\n")
 
-        def fill_test_dir(test_dir, fromdir='normal'):       
+        def fill_test_dir(test_dir, fromdir='normal'):
             for p in py.path.local(__file__).dirpath(
                 'examples', fromdir).listdir("*.py"):
                 p.copy(test_dir.join('test_'+p.basename))
@@ -115,7 +115,7 @@
         cls.one_test_dir = cls.manydir.join('one')
 
         fill_test_dir(test_normal_dir0)
-        
+
 
         test_normal_dir1 = cls.manydir.join('two', 
'test_normal1').ensure(dir=1)
         test_normal_dir2 = cls.manydir.join('two', 'pkg',
@@ -140,8 +140,8 @@
 
         run_param = runner.RunParam(self.one_test_dir,out)
         run_param.test_driver = test_driver
-        run_param.parallel_runs = 3        
-        
+        run_param.parallel_runs = 3
+
         res = runner.execute_tests(run_param, ['test_normal'], log)
 
         assert res
@@ -153,7 +153,7 @@
 
         log = log.getvalue()
         assert '\r\n' not in log
-        assert '\n' in log        
+        assert '\n' in log
         log_lines = log.splitlines()
 
         assert ". test_normal/test_example.py::test_one" in log_lines
@@ -178,7 +178,7 @@
         run_param.test_driver = test_driver
         run_param.parallel_runs = 3
         run_param.runfunc = run_param.dry_run
-        
+
         res = runner.execute_tests(run_param, ['test_normal'], log)
 
         assert not res
@@ -187,11 +187,11 @@
 
         out_lines = out.getvalue().splitlines()
 
-        assert len(out_lines) == 5
+        assert len(out_lines) == 6
 
-        assert out_lines[2].startswith("++ starting")
-        assert out_lines[4].startswith("run [")
-        for line in out_lines[2:]:
+        assert out_lines[3].startswith("++ starting")
+        assert out_lines[5].startswith("run [")
+        for line in out_lines[3:]:
             assert "test_normal" in line
 
     def test_many_dirs(self):
@@ -212,7 +212,7 @@
         testdirs = []
         run_param.collect_testdirs(testdirs)
         alltestdirs = testdirs[:]
-        
+
         res = runner.execute_tests(run_param, testdirs, log)
 
         assert res
@@ -282,7 +282,7 @@
             real_collect_one_testdir(testdirs, reldir, tests)
 
         run_param.collect_one_testdir = witness_collect_one_testdir
-        
+
         run_param.collect_testdirs(res)
 
         assert res == ['test_normal']
@@ -295,10 +295,10 @@
         run_param.collect_one_testdir = real_collect_one_testdir
         res = []
         run_param = runner.RunParam(self.two_test_dir, sys.stdout)
-        
+
         run_param.collect_testdirs(res)
 
-        assert sorted(res) == ['pkg/test_normal2', 'test_normal1']        
+        assert sorted(res) == ['pkg/test_normal2', 'test_normal1']
 
 
 class TestRunner(RunnerTests):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to