Opened 3 years ago

Last modified 3 years ago

#28452 new New feature

Consider adding a test command argument --locals to show traceback locals

Reported by: David Sanders Owned by: nobody
Component: Testing framework Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by David Sanders)

I'd like to suggest adding an argument to the test command, --locals, that simply passes tb_locals=True to unittest.TextTestRunner().

Currently it looks as though support for adding custom test runner kwargs was improved in 1.11 with ticket #26981 whereby one can provide a custom test runner and override get_test_runner_kwargs() however I think it would be nice to be able to examine locals without having to setup a custom test runner.

Please note that the tb_locals argument was introduced in Python 3.5, so this would need to be taken into consideration.

Change History (4)

comment:1 Changed 3 years ago by David Sanders

Description: modified (diff)
Version: 1.11master

comment:2 Changed 3 years ago by David Sanders

Comment from jtiai on #django:

About #28452 Well it might generate quite lot of output and it potentially can output secrets that you don't want to leak out.

comment:3 Changed 3 years ago by Tim Graham

There might be some risk of heading down the path of reimplementing many features of pytest. How do we decide which of those features to add to Django?

comment:4 Changed 3 years ago by Tim Graham

Triage Stage: UnreviewedSomeday/Maybe

It would probably be best to reach a consensus on the DevelopersMailingList before proceeding.

Note: See TracTickets for help on using tickets.
Back to Top