Closed AbeEstrada closed 3 months ago
Hmm :thinking:... quite interesting.
From what I can see here, the test function has yet to be executed.
For some context on my inference, see the docstring of the function in the third to the last stack frame. It states:
Execute the underlying test function.
and looking through the last two frames, it [strongly] doesn't seem like the test function has been executed.
Hence, the issue seems to be within the pytest
framework, which is rather strange.
Or did you hit Ctrl-C
very early? If so, I'll appreciate if you can run it again, wait a considerable amount of time and:
RecursionError
(no idea why I suspect recursion here, just wanna be sure).Ctrl-C
.Try this multiple times (copying/saving the traceback each time) and check if the tracebacks all end at the same frame.
If you are chanced to try this, let me know the results, please. There's no rush, you can do this at your convinience.
I'm really sorry to bother you. :pray: The issue is, I can't seem to reproduce it on my end (with a similar environment, except that I'm on Linux) and I don't have immediate/easy access to a Mac.
Thank you very much. :smiley:
Don't worry, I know this is going to be hard going back and forth. I hope this helps. I had to press Ctrl+C
five times to be able to stop it. I waited and I couldn't get the RecursionError
but I was able to get a different traceback.
Traceback (most recent call last):
File "/Code/term-image/src/term_image/renderable/_renderable.py", line 577, in draw
output.write(render)
File "/Code/term-image/tests/renderable/test_renderable.py", line 215, in write
type(slave).write(slave, string)
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Code/term-image/tests/renderable/test_renderable.py", line 224, in capture_stdout_pty
yield master, buffer
File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/tests/renderable/test_renderable.py", line 923, in test_default
echo_space.draw()
File "/Code/term-image/src/term_image/renderable/_renderable.py", line 585, in draw
output.write("\n")
File "/Code/term-image/tests/renderable/test_renderable.py", line 215, in write
type(slave).write(slave, string)
KeyboardInterrupt
During handling of the above exception, another exception occurred:
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/main.py", line 285, in wrap_session
session.exitstatus = doit(config, session) or 0
^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/main.py", line 339, in _main
config.hook.pytest_runtestloop(session=session)
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
raise exception.with_traceback(exception.__traceback__)
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
teardown.throw(exception) # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/logging.py", line 807, in pytest_runtestloop
return (yield) # Run all the tests.
^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/main.py", line 364, in pytest_runtestloop
item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
raise exception.with_traceback(exception.__traceback__)
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
teardown.throw(exception) # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/warnings.py", line 111, in pytest_runtest_protocol
return (yield)
^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
teardown.throw(exception) # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/assertion/__init__.py", line 176, in pytest_runtest_protocol
return (yield)
^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
teardown.throw(exception) # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/unittest.py", line 421, in pytest_runtest_protocol
res = yield
^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
teardown.throw(exception) # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/faulthandler.py", line 85, in pytest_runtest_protocol
return (yield)
^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/runner.py", line 116, in pytest_runtest_protocol
runtestprotocol(item, nextitem=nextitem)
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/runner.py", line 135, in runtestprotocol
reports.append(call_and_report(item, "call", log))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/runner.py", line 240, in call_and_report
call = CallInfo.from_call(
^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/runner.py", line 341, in from_call
result: Optional[TResult] = func()
^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/runner.py", line 241, in <lambda>
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
raise exception.with_traceback(exception.__traceback__)
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
teardown.throw(exception) # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/threadexception.py", line 87, in pytest_runtest_call
yield from thread_exception_runtest_hook()
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/threadexception.py", line 63, in thread_exception_runtest_hook
yield
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
teardown.throw(exception) # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/unraisableexception.py", line 90, in pytest_runtest_call
yield from unraisable_exception_runtest_hook()
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/unraisableexception.py", line 65, in unraisable_exception_runtest_hook
yield
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
teardown.throw(exception) # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/logging.py", line 850, in pytest_runtest_call
yield from self._runtest_for(item, "call")
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/logging.py", line 833, in _runtest_for
yield
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
teardown.throw(exception) # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/capture.py", line 878, in pytest_runtest_call
return (yield)
^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
teardown.throw(exception) # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/skipping.py", line 257, in pytest_runtest_call
return (yield)
^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/runner.py", line 173, in pytest_runtest_call
item.runtest()
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/python.py", line 1632, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
raise exception.with_traceback(exception.__traceback__)
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/python.py", line 162, in pytest_pyfunc_call
result = testfunction(**testargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 80, in inner
with self._recreate_cm():
File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 158, in __exit__
self.gen.throw(value)
File "/Code/term-image/tests/renderable/test_renderable.py", line 223, in capture_stdout_pty
with master, slave:
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Code/term-image/venv/bin/pytest", line 8, in <module>
sys.exit(console_main())
^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 206, in console_main
code = main()
^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 178, in main
ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
raise exception.with_traceback(exception.__traceback__)
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/main.py", line 332, in pytest_cmdline_main
return wrap_session(config, _main)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/main.py", line 299, in wrap_session
config.hook.pytest_keyboard_interrupt(excinfo=excinfo)
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
raise exception.with_traceback(exception.__traceback__)
File "/Code/term-image/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/terminal.py", line 906, in pytest_keyboard_interrupt
self._keyboardinterrupt_memo = excinfo.getrepr(funcargs=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/_code/code.py", line 696, in getrepr
return fmt.repr_excinfo(self)
^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/_code/code.py", line 1063, in repr_excinfo
reprtraceback = self.repr_traceback(excinfo_)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/_code/code.py", line 993, in repr_traceback
self.repr_traceback_entry(entry, excinfo if last == entry else None)
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/_code/code.py", line 931, in repr_traceback_entry
source = self._getentrysource(entry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/_code/code.py", line 833, in _getentrysource
source = entry.getsource(self.astcache)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/_code/code.py", line 251, in getsource
source = self.frame.code.fullsource
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/_code/code.py", line 107, in fullsource
full, _ = findsource(self.raw)
^^^^^^^^^^^^^^^^^^^^
File "/Code/term-image/venv/lib/python3.12/site-packages/_pytest/_code/source.py", line 120, in findsource
sourcelines, lineno = inspect.findsource(obj)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/inspect.py", line 1083, in findsource
module = getmodule(object, file)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/inspect.py", line 1002, in getmodule
if f == _filesbymodname.get(modname, None):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
It does help, thank you.
From what I can infer, the hang seems to occur when performing an operation on an open file object with an underlying pty slave file descriptor, particularly write operations (it seems).
Anyways, there isn't enough info to tell why this is happening. For that, I guess I'll have to wait till I can get access to a Mac and investigate further.
As soon as I have more info, I'll get back to you.
On another note, this has also further emphasized the need to test across platforms. I'll make necessary changes to the CI as soon as possible, to also run the tests on Mac and Windows, if possible.
Thank you very much for your time and effort. :pray:
I tried setting up CI jobs to build the package and run tests on Windows and macOS. Everything worked fine (not without a hitch though) except the tests on macOS just as you've pointed out. The tests halted at the same point, I had to cancel the jobs. See here.
Hence, I'll still have to wait until I get my hands on a Mac and investigate. In the meantime, I've excluded macOS from the list of OSes to run the tests on.
I'll keep you updated.
Thank you very much. :smiley:
It fails using:
('apple_terminal', '453')
('wezterm', '20240203-110809-5046fc22')
It displays images fine using the tutorial from the site:
I only noticed this when running explictly the tests, all the other tests pass.
Here is the traceback: