Any trick to integrating `ipdb` I tried adding <h...
# general
c
Any trick to integrating
ipdb
I tried adding https://www.pantsbuild.org/docs/python-test-goal#running-tests-interactively so added
pytest_plugins.add = *[*"ipdb"*]
got*
OSError: pytest: reading from stdin while output is captured! Consider using '-s'
When running
--debug
h
Yeah, use
./pants test --debug path/to/test.py -- -s
c
Copy code
Exception in thread Thread-4634:                                                                                                                                                                                                                                                 
Traceback (most recent call last):    
  File "/usr/local/Cellar/python@3.8/3.8.6_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()                  
  File "/usr/local/Cellar/python@3.8/3.8.6_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)                                                                                                                                                                                                                                    
  File "/Users/charlieoconor/.cache/pants/named_caches/pex_root/installed_wheels/ca8fa276df2a35f3a30811591ce9fc738a22e0e9/ipython-7.19.0-py3-none-any.whl/IPython/terminal/debugger.py", line 122, in in_thread
    line = self.pt_app.prompt()                                                                                                    
  File "/Users/charlieoconor/.cache/pants/named_caches/pex_root/installed_wheels/903db9cbbff9430b1bff5b8349be0259d4fa03a1/prompt_toolkit-3.0.8-py3-none-any.whl/prompt_toolkit/shortcuts/prompt.py", line 1013, in prompt
    return self.app.run(set_exception_handler=set_exception_handler)                                                                                                                                                                                                             
  File "/Users/charlieoconor/.cache/pants/named_caches/pex_root/installed_wheels/903db9cbbff9430b1bff5b8349be0259d4fa03a1/prompt_toolkit-3.0.8-py3-none-any.whl/prompt_toolkit/application/application.py", line 816, in run
    return loop.run_until_complete(                                                                                                                                                                                                                                              
  File "/usr/local/Cellar/python@3.8/3.8.6_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()                                                                                                                                                                                                                                                       
  File "/Users/charlieoconor/.cache/pants/named_caches/pex_root/installed_wheels/903db9cbbff9430b1bff5b8349be0259d4fa03a1/prompt_toolkit-3.0.8-py3-none-any.whl/prompt_toolkit/application/application.py", line 783, in run_async
    return await _run_async2()                                                                                                                                                                                                                                                   
  File "/Users/charlieoconor/.cache/pants/named_caches/pex_root/installed_wheels/903db9cbbff9430b1bff5b8349be0259d4fa03a1/prompt_toolkit-3.0.8-py3-none-any.whl/prompt_toolkit/application/application.py", line 765, in _run_async2
    result = await _run_async()                                                                                                                                                                                                                                                  
  File "/Users/charlieoconor/.cache/pants/named_caches/pex_root/installed_wheels/903db9cbbff9430b1bff5b8349be0259d4fa03a1/prompt_toolkit-3.0.8-py3-none-any.whl/prompt_toolkit/application/application.py", line 696, in _run_async
    with self.input.raw_mode(), self.input.attach(                                                                                                                                                                                                                               
  File "/Users/charlieoconor/.cache/pants/named_caches/pex_root/installed_wheels/903db9cbbff9430b1bff5b8349be0259d4fa03a1/prompt_toolkit-3.0.8-py3-none-any.whl/prompt_toolkit/input/vt100.py", line 257, in __enter__
    os.write(self.fileno, b"\x1b[?1l")                                                                                                                                                                                                                                           
OSError: [Errno 9] Bad file descriptor            
Exception in thread Thread-4635:
It passed but got stuck in a loop printing the error message.
h
hm, try with
--no-pantsd
too. What do you mean stuck in a loop btw?
c
It kept printing that message until I killed the processes
đź‘€ 1
Haza 🎉 🎉 It worked
h
Yay! Sorry for the trouble. The
-- -s
thing is always going to be necessary but should be documented The
--no-pantsd
is a legit bug that we knew hit
ipython
, but I wasn’t certain it would hit
ipdb
. Known as higher priority to fix, as pantsd is pretty crucial to Pants’s performance
If you have a moment, a docs tweak would be appreciated! There’s a button in the top right corner to suggest an edit
c
Sure can help. Do you want just the
-- -s
requirement documented?
h
Yeah, that you need to use
--no-pantsd
and
-- -s
c
Cool
Not sure how if I submitted it correctly, but I tried to add the documentation
h
Thanks!
h
To elaborate,
--
means "pass subsequent arguments to pytest"
So
-s
is a pytest flag that tells it to always echo the test's output
Not just after a test fails
The more you know!