We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4890369 commit 6b5bc46Copy full SHA for 6b5bc46
1 file changed
lib/matplotlib/tests/test_backends_interactive.py
@@ -497,14 +497,14 @@ def test_webagg():
497
retcode = proc.poll()
498
# check that the subprocess for the server is not dead
499
assert retcode is None
500
- conn = urllib.request.urlopen(url)
501
- break
+ with urllib.request.urlopen(url):
+ # Do nothing; we've just confirmed that we can connect.
502
+ break
503
except urllib.error.URLError:
504
if time.perf_counter() > timeout:
505
pytest.fail("Failed to connect to the webagg server.")
506
else:
507
continue
- conn.close()
508
proc.send_signal(signal.SIGINT)
509
assert proc.wait(timeout=_test_timeout) == 0
510
finally:
0 commit comments