From 9e59740268250d273493063d0fcb14087b0881fb Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Fri, 22 Nov 2019 15:46:02 +0100 Subject: [PATCH] pyln-testing: Do not require a conftest.py to annotate tests In the c-lightning tests we have `tests/conftest.py` which annotates test function with the outcome. If we use pyln-testing outside of the c-lightning tree we cannot rely on that annotation being there, so we assume it passed. --- contrib/pyln-testing/pyln/testing/fixtures.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/pyln-testing/pyln/testing/fixtures.py b/contrib/pyln-testing/pyln/testing/fixtures.py index dbda7d4de..68ded53f4 100644 --- a/contrib/pyln-testing/pyln/testing/fixtures.py +++ b/contrib/pyln-testing/pyln/testing/fixtures.py @@ -47,7 +47,8 @@ def directory(request, test_base_dir, test_name): # determine whether we succeeded or failed. Outcome can be None if the # failure occurs during the setup phase, hence the use to getattr instead # of accessing it directly. - outcome = getattr(request.node, 'rep_call', None).outcome + rep_call = getattr(request.node, 'rep_call', None) + outcome = 'passed' if rep_call is None else rep_call.outcome failed = not outcome or request.node.has_errors or outcome != 'passed' if not failed: