Logger is now an attribute of the execution context

This commit is contained in:
2020-02-18 16:31:55 +01:00
parent 86c2ff58d4
commit 87f232b527
27 changed files with 213 additions and 243 deletions
+7 -8
View File
@@ -32,13 +32,12 @@ def is_same_success(sheerka, return_values):
return True
def expect_one(context, return_values, logger=None):
def expect_one(context, return_values):
"""
Checks if there is at least one success return value
If there is more than one, check if it's the same value
:param context:
:param return_values:
:param logger:
:return:
"""
@@ -75,10 +74,10 @@ def expect_one(context, return_values, logger=None):
successful_results[0].value,
parents=return_values)
else:
if logger and logger.isEnabledFor(logging.DEBUG):
context.log(logger, f"Too many successful results found by expect_one()", context.who)
if context.logger and context.logger.isEnabledFor(logging.DEBUG):
context.log(f"Too many successful results found by expect_one()", context.who)
for s in successful_results:
context.log(logger, f"-> {s}", context.who)
context.log(f"-> {s}", context.who)
return sheerka.ret(
context.who,
False,
@@ -86,10 +85,10 @@ def expect_one(context, return_values, logger=None):
parents=return_values)
# only errors, i cannot help you
if logger and logger.isEnabledFor(logging.DEBUG):
context.log(logger, f"Too many errors found by expect_one()", context.who)
if context.logger and context.logger.isEnabledFor(logging.DEBUG):
context.log(f"Too many errors found by expect_one()", context.who)
for s in successful_results:
context.log(logger, f"-> {s}", context.who)
context.log(f"-> {s}", context.who)
if len(return_values) == 1:
return sheerka.ret(