From 1da8ce65a62b855214903eaad9c031d784d1bbb6 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 14 Apr 2019 22:58:19 +0200 Subject: [PATCH 1/2] pytester: raise_on_kwargs: ignore branch coverage --- src/_pytest/pytester.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index 40b014dbd..1cf6515a0 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -77,7 +77,7 @@ def pytest_configure(config): def raise_on_kwargs(kwargs): __tracebackhide__ = True - if kwargs: + if kwargs: # pragma: no branch raise TypeError( "Unexpected keyword arguments: {}".format(", ".join(sorted(kwargs))) ) From f3dbe5a3084bd0386c07691f684652fb19b3d614 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 14 Apr 2019 22:58:41 +0200 Subject: [PATCH 2/2] pytester: listoutcomes: assert instead of implicit if --- src/_pytest/pytester.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index 1cf6515a0..532d799f2 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -312,7 +312,8 @@ class HookRecorder(object): passed.append(rep) elif rep.skipped: skipped.append(rep) - elif rep.failed: + else: + assert rep.failed, "Unexpected outcome: {!r}".format(rep) failed.append(rep) return passed, skipped, failed