Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#30676 closed New feature (fixed)

Add a --pdb option to the test runner

Reported by: Andrew Godwin Owned by: Andrew Godwin
Component: Testing framework Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The Django test runner currently does not offer a --pdb option like pytest (which, when a test fails, pops open a PDB debugger at that location). This would be incredibly valuable for debugging tests, and I feel we should add it.

Because of the multi-process nature of the test runner, this would only be possible if we were running with --parallel=1.

Change History (14)

comment:1 by Simon Charette, 5 years ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedNew feature

We should probably make the option default to ipdb if it's installed like we do with manage.py shell for IPython.

comment:2 by Andrew Godwin, 5 years ago

Owner: changed from nobody to Andrew Godwin
Status: newassigned

comment:3 by Andrew Godwin, 5 years ago

Agreed - I have opened a PR with my solution for this.

comment:4 by Andrew Godwin, 5 years ago

Has patch: set

comment:5 by Mariusz Felisiak, 5 years ago

Needs documentation: set

comment:6 by Markus Holtermann, 5 years ago

Needs documentation: unset
Triage Stage: AcceptedReady for checkin

comment:7 by Carlton Gibson, 5 years ago

This is great.

...this would only be possible if we were running with --parallel=1.

As per my comment on the PR, if I pass --pdb could --parallel=1 be implied? (I always want that right?)

comment:8 by Andrew Godwin, 5 years ago

I wasn't super happy about implying it, but I guess we could?

comment:9 by Carlton Gibson, 5 years ago

OK. (We can always come back if people decide they want that.). Good work.

comment:10 by Carlton Gibson <carlton@…>, 5 years ago

Resolution: fixed
Status: assignedclosed

In 052388ab:

Fixed #30676 -- Added --pdb option to test runner.

comment:11 by GitHub <noreply@…>, 5 years ago

In f4645263:

Refs #30676 -- Added test for invalid --pdb and --parallel usage in DiscoverRunner.

comment:12 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

In 2c43840:

Refs #30676 -- Added pdb argument to DiscoverRunner docs.

comment:13 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

In 33457aa3:

[3.1.x] Refs #30676 -- Added pdb argument to DiscoverRunner docs.

Backport of 2c43840dfba42ed02574a270d826fda08e4b50d1 from master

comment:14 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

In b44e2d62:

[3.0.x] Refs #30676 -- Added pdb argument to DiscoverRunner docs.

Backport of 2c43840dfba42ed02574a270d826fda08e4b50d1 from master

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