pytest: close file handles after use (cont.), and tidy-ups

- dante.py, dnsd.py, sshd.py: drop redundant conditions.
  Spotted in sshd by GitHub Code Quality.
- curl.py: comment out `if` to silence CodeQL warning.

Reported by GitHub CodeQL

Follow-up to 8145476d5d #21916

Closes #21917
This commit is contained in:
Viktor Szakats 2026-06-09 02:08:30 +02:00
parent 7b9d74abf6
commit cb4465bfe6
No known key found for this signature in database
9 changed files with 91 additions and 35 deletions

View file

@ -114,10 +114,10 @@ class LocalClient:
def dump_logs(self):
lines = []
lines.append('>>--stdout ----------------------------------------------\n')
with open(self._stdoutfile) as cstdout:
lines.extend(cstdout.readlines())
with open(self._stdoutfile) as fd:
lines.extend(fd.readlines())
lines.append('>>--stderr ----------------------------------------------\n')
with open(self._stderrfile) as cstderr:
lines.extend(cstderr.readlines())
with open(self._stderrfile) as fd:
lines.extend(fd.readlines())
lines.append('<<-------------------------------------------------------\n')
return ''.join(lines)