pytest: fix remaining code checker warnings
No binary (build failed)
—
(log yok)
| @@ -264,6 +264,8 @@ class TestWebsockets: | |
| f = b"\x88\x00" # CLOSE frame | |
| c.sendall(f) | |
| except OSError: | |
| + | # Client may close/reset while we intentionally flood frames. |
| + | # Send errors are expected here, ignore them. |
| pass | |
| time.sleep(1) | |
| c.close() | |
| @@ -484,8 +484,7 @@ class TestCA: | |
| else: | |
| try: | |
| names.append(x509.IPAddress(ipaddress.ip_address(name))) | |
| - | # TODO: specify specific exceptions here |
| - | except: # noqa: E722 |
| + | except ValueError: |
| names.append(x509.DNSName(name)) | |
| return csr.add_extension( | |
| @@ -284,11 +284,10 @@ class ExecResult: | |
| if with_stats: | |
| self._parse_stats() | |
| else: | |
| - | # noinspection PyBroadException |
| try: | |
| out = ''.join(self._stdout) | |
| self._json_out = json.loads(out) | |
| - | except: # noqa: E722 |
| + | except (json.JSONDecodeError, TypeError, ValueError): |
| pass | |
| def __repr__(self): | |
| @@ -300,8 +299,7 @@ class ExecResult: | |
| for line in self._stdout: | |
| try: | |
| self._stats.append(json.loads(line)) | |
| - | # TODO: specify specific exceptions here |
| - | except: # noqa: E722 |
| + | except (json.JSONDecodeError, TypeError, ValueError): |
| log.exception(f'not a JSON stat: {line}') | |
| break | |
| @@ -1031,8 +1029,6 @@ class CurlClient: | |
| cwd=self._run_dir, shell=False, | |
| env=self._run_env) | |
| profile = RunProfile(p.pid, started_at, self._run_dir) | |
| - | #if intext is not None and False: |
| - | # p.communicate(input=intext.encode(), timeout=1) |
| if self._with_perf: | |
| perf = PerfProfile(p.pid, self._run_dir) | |
| perf.start() | |