[Django] #36720: Printing how many tests found when running tests

6 views
Skip to first unread message

Django

unread,
Nov 9, 2025, 5:30:13 PM (3 days ago) Nov 9
to django-...@googlegroups.com
#36720: Printing how many tests found when running tests
----------------------+---------------------------------------------
Reporter: אורי | Type: Uncategorized
Status: new | Component: Testing framework
Version: 5.2 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------+---------------------------------------------
Hi,

When I run tests in Django up to 5.1.*, Django prints "Found 798 test(s)."
before running the tests. But in Django 5.2.*, Django prints "Found 798
test(s)." after running the tests. Since running the tests may take a long
time, I would like Django to print the number of tests found before
running the tests. This is a regression in Django 5.2. Is it possible to
revert this change, at least in future versions of Django?

By the way, why "test(s)"? It should be "test" if the number is one or
otherwise "tests".
--
Ticket URL: <https://code.djangoproject.com/ticket/36720>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 10, 2025, 9:38:50 AM (2 days ago) Nov 10
to django-...@googlegroups.com
#36720: Printing how many tests found when running tests
-----------------------------------+--------------------------------------
Reporter: אורי | Owner: (none)
Type: Uncategorized | Status: closed
Component: Testing framework | Version: 5.2
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by Jacob Walls):

* resolution: => worksforme
* status: new => closed

Comment:

Do you have any additional information to reproduce? Could not reproduce
at 2501958b5127020411df6271445ccfd0906df70e nor 5.2.8.
{{{
python3 manage.py test
}}}
{{{
Found 43 test(s).
Creating test database for alias 'default'...
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36720#comment:1>

Django

unread,
Nov 10, 2025, 11:12:11 AM (2 days ago) Nov 10
to django-...@googlegroups.com
#36720: Printing how many tests found when running tests
-----------------------------------+--------------------------------------
Reporter: אורי | Owner: (none)
Type: Uncategorized | Status: closed
Component: Testing framework | Version: 5.2
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Comment (by Tim Graham):

I've seen some unexpectedly ordered test runner output in the past. I
think it may have something to do with output buffer flushing and the fact
that some output uses logging while other output uses `print()`.
--
Ticket URL: <https://code.djangoproject.com/ticket/36720#comment:2>

Django

unread,
Nov 10, 2025, 7:42:10 PM (2 days ago) Nov 10
to django-...@googlegroups.com
#36720: Printing how many tests found when running tests
-----------------------------------+--------------------------------------
Reporter: אורי | Owner: (none)
Type: Uncategorized | Status: closed
Component: Testing framework | Version: 5.2
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Comment (by אורי):

Hi,

Compare the following runs and see the versions of Django in pip freeze.
It's quite consistent. When Django version >= 5.2 then it prints "Found
6398 test(s)." after the tests, otherwise it prints it before the tests.
And also notice what I wrote about test(s), isn't it time to switch to
test and tests?

https://github.com/speedy-net/speedy-
net/actions/runs/19144998415/job/54720135356
https://github.com/speedy-net/speedy-
net/actions/runs/17116743422/job/48549258817

Thanks,
Uri.
--
Ticket URL: <https://code.djangoproject.com/ticket/36720#comment:3>

Django

unread,
Nov 10, 2025, 8:17:33 PM (2 days ago) Nov 10
to django-...@googlegroups.com
#36720: Printing how many tests found when running tests
-----------------------------------+--------------------------------------
Reporter: אורי | Owner: (none)
Type: Uncategorized | Status: closed
Component: Testing framework | Version: 5.2
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Comment (by Jacob Walls):

There are a lot of variables at play, here, custom test runners, logger
configuration, so we can't infer that the version of Django has a
regression.

Have you tried with altering your logging setup or with setting
`PYTHONUNBUFFERED = 1`?

> And also notice what I wrote about test(s), isn't it time to switch to
test and tests?

A PR for that would be fine, but we don't need to have a ticket for it,
nothing is strictly wrong with it.
--
Ticket URL: <https://code.djangoproject.com/ticket/36720#comment:4>

Django

unread,
Nov 10, 2025, 8:18:24 PM (2 days ago) Nov 10
to django-...@googlegroups.com
#36720: Printing how many tests found when running tests
-----------------------------------+--------------------------------------
Reporter: אורי | Owner: (none)
Type: Uncategorized | Status: closed
Component: Testing framework | Version: 5.2
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Comment (by Natalia Bidart):

Replying to [comment:3 אורי]:
> Hi,
>
> Compare the following runs and see the versions of Django in pip freeze.
It's quite consistent. When Django version >= 5.2 then it prints "Found
6398 test(s)." after the tests, otherwise it prints it before the tests.

Hello! This is not what I see locally when running the tests. I have tried
the Django test suite and also running tests in other projects. I have
tried Python 3.12, 3.13, and 3.14.

We can't debug in your project, I'm sorry, we need you to provide a
minimal Django sample project or a failing test case for us to be able to
accept/advance this ticket. You can also reach out in the forum to ask for
debugging help.
--
Ticket URL: <https://code.djangoproject.com/ticket/36720#comment:5>

Django

unread,
4:39 AM (2 hours ago) 4:39 AM
to django-...@googlegroups.com
#36720: Printing how many tests found when running tests
-----------------------------------+--------------------------------------
Reporter: אורי | Owner: (none)
Type: Uncategorized | Status: closed
Component: Testing framework | Version: 5.2
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Comment (by אורי):

Replying to [comment:4 Jacob Walls]:
> Have you tried with altering your logging setup or with setting
`PYTHONUNBUFFERED = 1`?

It looks like adding `PYTHONUNBUFFERED=1` solves the problem. We are
checking this now.
--
Ticket URL: <https://code.djangoproject.com/ticket/36720#comment:6>
Reply all
Reply to author
Forward
0 new messages