Skip to content

Commit

Permalink
testing: don't spam stderr when the log file is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
ksedgwic committed Nov 16, 2023
1 parent 5463c04 commit da8dcd5
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions contrib/pyln-testing/pyln/testing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,12 +865,16 @@ def __init__(self, socket_path, executor=None, logger=logging,
def call(self, method, payload=None, cmdprefix=None, filter=None):
id = self.get_json_id(method, cmdprefix)
schemas = self.jsonschemas.get(method)
self.logger.debug(json.dumps({
"id": id,
"method": method,
"params": payload,
"filter": filter,
}, indent=2))
# Sometimes our log file is closed, don't spam stderr in this case
try:
self.logger.debug(json.dumps({
"id": id,
"method": method,
"params": payload,
"filter": filter,
}, indent=2))
except ValueError:
pass

# We only check payloads which are dicts, which is what we
# usually use: there are some cases which tests [] params,
Expand Down

0 comments on commit da8dcd5

Please sign in to comment.