Commit 1bc20596 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #644 from kmod/extra_test_counts

Include total-tests-run in our test-suite-results checking
parents 98364232 a2f78483
...@@ -7,5 +7,5 @@ create_virtenv(ENV_NAME, ["cheetah==2.4.4"], force_create = True) ...@@ -7,5 +7,5 @@ create_virtenv(ENV_NAME, ["cheetah==2.4.4"], force_create = True)
cheetah_exe = os.path.join(ENV_NAME, "bin", "cheetah") cheetah_exe = os.path.join(ENV_NAME, "bin", "cheetah")
env = os.environ env = os.environ
env["PATH"] = env["PATH"] + ":" + os.path.join(ENV_NAME, "bin") env["PATH"] = env["PATH"] + ":" + os.path.join(ENV_NAME, "bin")
expected = [{'errors': 4, 'failures': 53}, {'errors': 232, 'failures': 53}] expected = [{'ran': 2138, 'errors': 4, 'failures': 53}, {'ran': 2138, 'errors': 232, 'failures': 53}]
run_test([cheetah_exe, "test"], cwd=ENV_NAME, expected=expected, env=env) run_test([cheetah_exe, "test"], cwd=ENV_NAME, expected=expected, env=env)
...@@ -28,7 +28,7 @@ def install_and_test_mysqldb(): ...@@ -28,7 +28,7 @@ def install_and_test_mysqldb():
env = os.environ env = os.environ
env["TESTDB"] = "travis.cnf" env["TESTDB"] = "travis.cnf"
expected = [] expected = [{"ran": 69}]
run_test([nosetests_exe], cwd=MYSQLDB_DIR, expected=expected, env=env) run_test([nosetests_exe], cwd=MYSQLDB_DIR, expected=expected, env=env)
packages = ["nose==1.3.7"] packages = ["nose==1.3.7"]
......
...@@ -25,7 +25,7 @@ def install_and_test_protobuf(): ...@@ -25,7 +25,7 @@ def install_and_test_protobuf():
env["LD_LIBRARY_PATH"] = os.path.join(INSTALL_DIR, "lib") env["LD_LIBRARY_PATH"] = os.path.join(INSTALL_DIR, "lib")
subprocess.check_call([PYTHON_EXE, "setup.py", "build"], cwd=PROTOBUF_PY_DIR, env=env) subprocess.check_call([PYTHON_EXE, "setup.py", "build"], cwd=PROTOBUF_PY_DIR, env=env)
expected = [{"failures": 0, "errors": 1}] expected = [{"ran": 216, "failures": 0, "errors": 1}]
run_test([PYTHON_EXE, "setup.py", "test"], cwd=PROTOBUF_PY_DIR, expected=expected, env=env) run_test([PYTHON_EXE, "setup.py", "test"], cwd=PROTOBUF_PY_DIR, expected=expected, env=env)
create_virtenv(ENV_NAME, None, force_create = True) create_virtenv(ENV_NAME, None, force_create = True)
......
...@@ -36,7 +36,7 @@ def install_and_test_pyicu(): ...@@ -36,7 +36,7 @@ def install_and_test_pyicu():
subprocess.check_call([PYTHON_EXE, "setup.py", "build"], cwd=PYICU_DIR, env=env) subprocess.check_call([PYTHON_EXE, "setup.py", "build"], cwd=PYICU_DIR, env=env)
subprocess.check_call([PYTHON_EXE, "setup.py", "install"], cwd=PYICU_DIR, env=env) subprocess.check_call([PYTHON_EXE, "setup.py", "install"], cwd=PYICU_DIR, env=env)
expected = [] expected = [{'ran': 17}]
run_test([PYTHON_EXE, "setup.py", "test"], cwd=PYICU_DIR, expected=expected) run_test([PYTHON_EXE, "setup.py", "test"], cwd=PYICU_DIR, expected=expected)
create_virtenv(ENV_NAME, None, force_create = True) create_virtenv(ENV_NAME, None, force_create = True)
......
...@@ -36,22 +36,35 @@ def pip_install(name, package_list): ...@@ -36,22 +36,35 @@ def pip_install(name, package_list):
def parse_output(output): def parse_output(output):
result = [] result = []
it = re.finditer("FAILED \(failures=(\d+), errors=(\d+)\)", output) for l in output.split('\n'):
for m in it: m = re.match("Ran (\d+) tests in", l)
d = { "failures" : int(m.group(1)), "errors" : int(m.group(2)) } if m:
result.append(d) result.append({"ran": int(m.group(1))})
it = re.finditer("FAILED \(errors=(\d+), failures=(\d+)\)", output)
for m in it: m = re.match("FAILED \(failures=(\d+), errors=(\d+)\)", l)
d = { "failures" : int(m.group(2)), "errors" : int(m.group(1)) } if m:
result.append(d) d = result[-1]
it = re.finditer("FAILED \(failures=(\d+)\)", output) assert d.keys() == ["ran"]
for m in it: d['failures'] = int(m.group(1))
d = { "failures" : int(m.group(1)), "errors" : 0 } d['errors'] = int(m.group(2))
result.append(d) m = re.match("FAILED \(errors=(\d+), failures=(\d+)\)", l)
it = re.finditer("FAILED \(errors=(\d+)\)", output) if m:
for m in it: d = result[-1]
d = { "failures" : 0, "errors" : int(m.group(1)) } assert d.keys() == ["ran"]
result.append(d) d['failures'] = int(m.group(2))
d['errors'] = int(m.group(1))
m = re.match("FAILED \(failures=(\d+)\)", l)
if m:
d = result[-1]
assert d.keys() == ["ran"]
d['failures'] = int(m.group(1))
d['errors'] = 0
m = re.match("FAILED \(errors=(\d+)\)", l)
if m:
d = result[-1]
assert d.keys() == ["ran"]
d['failures'] = 0
d['errors'] = int(m.group(1))
return result return result
def run_test(cmd, cwd, expected, env = None): def run_test(cmd, cwd, expected, env = None):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment