]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
If there is an error running pytest, mark job as dead
authorAndrew Schoen <aschoen@redhat.com>
Thu, 12 Feb 2015 21:14:30 +0000 (15:14 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Thu, 12 Feb 2015 21:14:30 +0000 (15:14 -0600)
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
teuthology/task/tests/__init__.py

index ba7dea8f868812e25d4d97db4ccf2252562f88a9..bbed7e26a95d3040e5a0c1d55ac7141a2fc5185c 100644 (file)
@@ -74,15 +74,21 @@ def task(ctx, config):
     and then executing them with the teuthology ctx and config args.
     Your tests must follow standard pytest conventions to be discovered.
     """
-    status = pytest.main(
-        args=[
-            '-q',
-            '--pyargs', __name__
-        ],
-        plugins=[TeuthologyContextPlugin(ctx, config)]
-    )
-    if status == 0:
-        log.info("OK. All tests passed!")
+    try:
+        status = pytest.main(
+            args=[
+                '-q',
+                '--pyargs', __name__
+            ],
+            plugins=[TeuthologyContextPlugin(ctx, config)]
+        )
+    except Exception:
+        log.exception("Saw failure running pytest")
+        ctx.summary["status"] = "dead"
     else:
-        log.error("FAIL. Saw test failures...")
-        ctx.summary["status"] = "fail"
+        if status == 0:
+            log.info("OK. All tests passed!")
+            ctx.summary["status"] = "pass"
+        else:
+            log.error("FAIL. Saw test failures...")
+            ctx.summary["status"] = "fail"