[issue18765] unittest needs a way to launch pdb.post_mortem or other debug hooks

2021-05-19 Thread Dominik Vilsmeier


Dominik Vilsmeier  added the comment:

I wasn't aware of this issue so apparently I submitted a duplicate (#42722) 
half a year ago. The solution I implemented relies on simply calling 
`TestCase.debug`
and `TestSuite.debug` which makes it a lightweight change. From the perspective 
of the debugger the situation is thus no different than running a "normal" 
script. The other issue also has a pull request attached.

--
nosy: +Dominik V.

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18765] unittest needs a way to launch pdb.post_mortem or other debug hooks

2020-05-01 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

See #36825 about making TextCase argument aware.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18765] unittest needs a way to launch pdb.post_mortem or other debug hooks

2020-05-01 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I would be more interested in being able to launch IDLE's visual debugger 
(likely after some revision) so I would want the hook to be general (as 
suggested by the current title) and not limited to only pdb.

--
nosy: +terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18765] unittest needs a way to launch pdb.post_mortem or other debug hooks

2019-10-27 Thread Benjamin Edwards

Benjamin Edwards  added the comment:

Hi Rémi, I'd also be happy to take a look at your problem, if it's still open, 
do you have patch of what you've done so far?

--
nosy: +benedwards14

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18765] unittest needs a way to launch pdb.post_mortem or other debug hooks

2019-05-08 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi Windson, I had a working patch but got stuck on making this behavior 
optional (the `if SOMETHING_SAYS_TO_ENABLE_THIS:` in @gregory.p.smith initial 
post).

To make TestCase aware of the command line arguments given to the test runner I 
opened issue 36825 so we could do `python test_myprogram.py` but did not get 
any feedback on it yet.

If you see a way around this, please go ahead :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18765] unittest needs a way to launch pdb.post_mortem or other debug hooks

2019-05-07 Thread Windson Yang

Windson Yang  added the comment:

Hello, @Rémi, are you still working on this issue?

--
nosy: +Windson Yang

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18765] unittest needs a way to launch pdb.post_mortem or other debug hooks

2019-02-05 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

@gregory.p.smith Do you think the debugHook should be added to the test case or 
the test runner?

If we add it to the test case, how do you think the runner should tell the test 
case what flags have been given on the command line?

I feel like adding a new class variable to TestCase could break some user code 
but no other option seems better to me.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18765] unittest needs a way to launch pdb.post_mortem or other debug hooks

2019-02-04 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
keywords: +easy
versions: +Python 3.8 -Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18765] unittest needs a way to launch pdb.post_mortem or other debug hooks

2019-02-04 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi, this is the only reason I still use pytest, I would love to be able to use 
only unittest and the constant copy-paste is not a great solution and is not 
very user friendly.

I would like to wotk on this issue.

StackOverflow has many example on how to override testRunner or to create 
decorators to call pm() on failure but there is no clean solution to do this 
yet.

It's especially a problem when using a project developped by another team that 
did not set up such utilities, but a default debugHook that calls pgb if a flag 
is given would be very useful.

--
nosy: +remi.lapeyre

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18765] unittest needs a way to launch pdb.post_mortem or other debug hooks

2013-08-17 Thread Michael Foord

Michael Foord added the comment:

This is done in outcome.testPartExecutor. If you add it in the except clause 
then it is *only* called on test failure or error. If we call it 
unconditionally with the result (maybe a sys.exc_info tuple?) then it could 
have extended use cases (perhaps custom reporting)?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18765
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18765] unittest needs a way to launch pdb.post_mortem or other debug hooks

2013-08-16 Thread Gregory P. Smith

New submission from Gregory P. Smith:

A few times now I've seen people write something that overrides and 
re-implements the unittest.TestCase run() method, copying most of the 
implementation but adding one feature:

The ability for pdb.post_mortem() to be called after every phase of execution 
iff an exception/error was caught (setUp(), the testMethod() call itself and 
tearDown()).

I really hate seeing people have to copy the run method implementation and 
modify it.

We could support this either by adding another debugHook() method to the 
TestCase API.  Proposal: it gets called within the except: clause surrounding 
each phase of test execution.

Turning on support for automatic pdb.post_mortem(), typically controlled via a 
flag or other environment configurable as it isn't desirable during automation:

  def debugHook(self):
if SOMETHING_SAYS_TO_ENABLE_THIS:
  pdb.post_mortem()

no more copy and pasting the run() method.

--
components: Library (Lib)
messages: 195444
nosy: gregory.p.smith, michael.foord
priority: normal
severity: normal
stage: needs patch
status: open
title: unittest needs a way to launch pdb.post_mortem or other debug hooks
type: enhancement
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18765
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com