Opened 3 months ago

Last modified 3 months ago

#30415 new New feature

Refactor runtests.py to allow using other test runners.

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

Description

I think it would be very nice if pytest could be used to run Django's tests.

I've started working on this, by using a pytest plugin/conftest, which reuses parts from tests/runtests.py, which I've therefore started to make more modular (https://github.com/django/django/pull/11289).

It is not meant to replace the current test runner (or tests), but would just allow to use pytest out of the box seamlessly, with all the additional features and plugins it provides.

Is this something that is wanted in general?

Change History (3)

comment:1 Changed 3 months ago by Carlton Gibson

Triage Stage: UnreviewedAccepted

Hi Daniel.

I'm very happy for some refactoring to help re-use here.
(What's counts as "Fixed" for this ticket?)

(Aside: would a test runner subclass letting us use plain asserts ever get passed the line? Any interest in writing such? Fancy pinging the DevelopersMailingList?)

comment:2 Changed 3 months ago by Carlton Gibson

Summary: Using pytest as test runnerRefactor runtests.py to allow using other test runners.

comment:3 Changed 3 months ago by Daniel Hahler

What's counts as "Fixed" for this ticket?

When it is good enough for the pytest plugin/integration.

would a test runner subclass letting us use plain asserts ever get passed the line?

Not sure I follow, but the pytest wrapper would not be a subclass of the Django test runner, would would rather use it, and parts from tuntests. Any interest in writing such?

pytest then would allow to use plain asserts in tests - but that is out of scope here.

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