MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_webagg

Function test_webagg

lib/matplotlib/tests/test_backends_interactive.py:484–511  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

482 reason="this test fails an azure for unknown reasons")
483@pytest.mark.skipif(sys.platform == "win32", reason="Cannot send SIGINT on Windows.")
484def test_webagg():
485 pytest.importorskip("tornado")
486 source = (inspect.getsource(_test_interactive_impl) +
487 "\n_test_interactive_impl()")
488 rc = '{"backend": "webagg"}'
489 with _WaitForStringPopen([sys.executable, "-c", source, rc]) as proc:
490 try:
491 buf = proc.wait_for('Press Ctrl+C')
492 url = re.search(r'visit (https?:\/\/\S+)', buf).group(1)
493 timeout = time.perf_counter() + _test_timeout
494 while True:
495 try:
496 retcode = proc.poll()
497 # check that the subprocess for the server is not dead
498 assert retcode is None
499 with urllib.request.urlopen(url):
500 # Do nothing; we've just confirmed that we can connect.
501 break
502 except urllib.error.URLError:
503 if time.perf_counter() > timeout:
504 pytest.fail("Failed to connect to the webagg server.")
505 else:
506 continue
507 proc.send_signal(signal.SIGINT)
508 assert proc.wait(timeout=_test_timeout) == 0
509 finally:
510 if proc.poll() is None:
511 proc.kill()
512
513
514def _lazy_headless():

Callers

nothing calls this directly

Calls 4

_WaitForStringPopenClass · 0.85
wait_forMethod · 0.80
groupMethod · 0.80
searchMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…