Closed
Description
Summary
Appveyor Qt sigint tests appear to be consistently failing due DLL loading
Relevant log portion
__________________________ test_sigint[show-kwargs0] __________________________
[gw0] win32 -- Python 3.8.13 C:\Miniconda3-x64\envs\test-environment\python.exe
target = 'show', kwargs = {'block': True}
@pytest.mark.backend('QtAgg', skip_on_importerror=True)
@pytest.mark.parametrize("target, kwargs", [
('show', {'block': True}),
('pause', {'interval': 10})
])
def test_sigint(target, kwargs):
backend = plt.get_backend()
proc = WaitForStringPopen(
[sys.executable, "-c",
inspect.getsource(_test_sigint_impl) +
f"\n_test_sigint_impl({backend!r}, {target!r}, {kwargs!r})"])
try:
proc.wait_for('DRAW')
> stdout, _ = proc.communicate(timeout=_test_timeout)
lib\matplotlib\tests\test_backend_qt.py:130:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\Miniconda3-x64\envs\test-environment\lib\subprocess.py:1028: in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <matplotlib.tests.test_backend_qt.WaitForStringPopen object at 0x0000004E17E65CD0>
input = None, endtime = 526.437, orig_timeout = 60
def _communicate(self, input, endtime, orig_timeout):
# Start reader threads feeding into a list hanging off of this
# object, unless they've already been started.
if self.stdout and not hasattr(self, "_stdout_buff"):
self._stdout_buff = []
self.stdout_thread = \
threading.Thread(target=self._readerthread,
args=(self.stdout, self._stdout_buff))
self.stdout_thread.daemon = True
self.stdout_thread.start()
if self.stderr and not hasattr(self, "_stderr_buff"):
self._stderr_buff = []
self.stderr_thread = \
threading.Thread(target=self._readerthread,
args=(self.stderr, self._stderr_buff))
self.stderr_thread.daemon = True
self.stderr_thread.start()
if self.stdin:
self._stdin_write(input)
# Wait for the reader threads, or time out. If we time out, the
# threads remain reading and the fds left open in case the user
# calls communicate again.
if self.stdout is not None:
self.stdout_thread.join(self._remaining_time(endtime))
if self.stdout_thread.is_alive():
> raise TimeoutExpired(self.args, orig_timeout)
E subprocess.TimeoutExpired: Command '['C:\\Miniconda3-x64\\envs\\test-environment\\python.exe', '-c', "def _test_sigint_impl(backend, target_name, kwargs):\n import sys\n import matplotlib.pyplot as plt\n import os\n import threading\n\n plt.switch_backend(backend)\n from matplotlib.backends.qt_compat import QtCore # noqa\n\n def interrupter():\n if sys.platform == 'win32':\n import win32api\n win32api.GenerateConsoleCtrlEvent(0, 0)\n else:\n import signal\n os.kill(os.getpid(), signal.SIGINT)\n\n target = getattr(plt, target_name)\n timer = threading.Timer(1, interrupter)\n fig = plt.figure()\n fig.canvas.mpl_connect(\n 'draw_event',\n lambda *args: print('DRAW', flush=True)\n )\n fig.canvas.mpl_connect(\n 'draw_event',\n lambda *args: timer.start()\n )\n try:\n target(**kwargs)\n except KeyboardInterrupt:\n print('SUCCESS', flush=True)\n\n_test_sigint_impl('QtAgg', 'show', {'block': True})"]' timed out after 60 seconds
C:\Miniconda3-x64\envs\test-environment\lib\subprocess.py:1401: TimeoutExpired
----------------------------- Captured log setup ------------------------------
DEBUG matplotlib.pyplot:pyplot.py:316 Loaded backend QtAgg version 5.15.7.
---------------------------- Captured stderr call -----------------------------
Windows fatal exception: code 0xc0000139
Current thread 0x00000900 (most recent call first):
File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 1166 in create_module
File "<frozen importlib._bootstrap>", line 556 in module_from_spec
File "<frozen importlib._bootstrap>", line 657 in _load_unlocked
File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 991 in _find_and_load
File "<string>", line 12 in interrupter
File "C:\Miniconda3-x64\envs\test-environment\lib\threading.py", line 1254 in run
File "C:\Miniconda3-x64\envs\test-environment\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Miniconda3-x64\envs\test-environment\lib\threading.py", line 890 in _bootstrap
Thread 0x00000344 (most recent call first):
File "c:\projects\matplotlib\lib\matplotlib\backends\qt_compat.py", line 168 in _exec
File "c:\projects\matplotlib\lib\matplotlib\backends\backend_qt.py", line 1022 in mainloop
File "c:\projects\matplotlib\lib\matplotlib\backend_bases.py", line 3554 in show
File "c:\projects\matplotlib\lib\matplotlib\pyplot.py", line 421 in show
File "<string>", line 30 in _test_sigint_impl
File "<string>", line 34 in <module>
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Miniconda3-x64\envs\test-environment\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Miniconda3-x64\envs\test-environment\lib\threading.py", line 1254, in run
self.function(*self.args, **self.kwargs)
File "<string>", line 12, in interrupter
ImportError: DLL load failed while importing win32api: The specified procedure could not be found.
---------------------------- Captured log teardown ----------------------------
DEBUG matplotlib.pyplot:pyplot.py:316 Loaded backend agg version v2.2.
_________________________ test_sigint[pause-kwargs1] __________________________
[gw0] win32 -- Python 3.8.13 C:\Miniconda3-x64\envs\test-environment\python.exe
target = 'pause', kwargs = {'interval': 10}
@pytest.mark.backend('QtAgg', skip_on_importerror=True)
@pytest.mark.parametrize("target, kwargs", [
('show', {'block': True}),
('pause', {'interval': 10})
])
def test_sigint(target, kwargs):
backend = plt.get_backend()
proc = WaitForStringPopen(
[sys.executable, "-c",
inspect.getsource(_test_sigint_impl) +
f"\n_test_sigint_impl({backend!r}, {target!r}, {kwargs!r})"])
try:
proc.wait_for('DRAW')
stdout, _ = proc.communicate(timeout=_test_timeout)
except:
proc.kill()
stdout, _ = proc.communicate()
raise
print(stdout)
> assert 'SUCCESS' in stdout
E AssertionError: assert 'SUCCESS' in '\n'
lib\matplotlib\tests\test_backend_qt.py:136: AssertionError
----------------------------- Captured log setup ------------------------------
DEBUG matplotlib.pyplot:pyplot.py:316 Loaded backend QtAgg version 5.15.7.
---------------------------- Captured stdout call -----------------------------
---------------------------- Captured stderr call -----------------------------
Windows fatal exception: code 0xc0000139
Current thread 0x00000664 (most recent call first):
File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 1166 in create_module
File "<frozen importlib._bootstrap>", line 556 in module_from_spec
File "<frozen importlib._bootstrap>", line 657 in _load_unlocked
File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 991 in _find_and_load
File "<string>", line 12 in interrupter
File "C:\Miniconda3-x64\envs\test-environment\lib\threading.py", line 1254 in run
File "C:\Miniconda3-x64\envs\test-environment\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Miniconda3-x64\envs\test-environment\lib\threading.py", line 890 in _bootstrap
Thread 0x00000538 (most recent call first):
File "c:\projects\matplotlib\lib\matplotlib\backends\qt_compat.py", line 168 in _exec
File "c:\projects\matplotlib\lib\matplotlib\backends\backend_qt.py", line 408 in start_event_loop
File "c:\projects\matplotlib\lib\matplotlib\pyplot.py", line 557 in pause
File "<string>", line 30 in _test_sigint_impl
File "<string>", line 34 in <module>
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Miniconda3-x64\envs\test-environment\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Miniconda3-x64\envs\test-environment\lib\threading.py", line 1254, in run
self.function(*self.args, **self.kwargs)
File "<string>", line 12, in interrupter
ImportError: DLL load failed while importing win32api: The specified procedure could not be found.
---------------------------- Captured log teardown ----------------------------
DEBUG matplotlib.pyplot:pyplot.py:316 Loaded backend agg version v2.2.
Proposed fix
No response