diff --git a/tests/http/test_20_websockets.py b/tests/http/test_20_websockets.py index 00fc394a3b..0a86e6439b 100644 --- a/tests/http/test_20_websockets.py +++ b/tests/http/test_20_websockets.py @@ -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() diff --git a/tests/http/testenv/certs.py b/tests/http/testenv/certs.py index 3e206efcdc..85012634a5 100644 --- a/tests/http/testenv/certs.py +++ b/tests/http/testenv/certs.py @@ -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( diff --git a/tests/http/testenv/curl.py b/tests/http/testenv/curl.py index 779fd48bf9..d8e6a194e0 100644 --- a/tests/http/testenv/curl.py +++ b/tests/http/testenv/curl.py @@ -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()