﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32641	Log the number of tests found in DiscoverRunner.build_suite()	Chris Jerdonek	Girish Sontakke	"Currently, when running tests with `DiscoverRunner`, the number of tests is displayed only at the very end of the test run.

However, knowing this number at the ''beginning'' of a test run could I think provide an increase in usability. For example, you'd be able to notice right away if a new test you're working on was or wasn't included as expected, based on whether the number is the same or different from the previous run. Similarly, the early feedback would be helpful as a sanity check if you're trying to reduce the number of tests using different command-line options, and you're not sure if your invocation is correct.

Thus, I'd like to suggest that `DiscoverRunner` display by default the number of tests discovered (and that match any filters) at the earliest point where this is known. This could be done inside `DiscoverRunner.build_suite()`.

The code change could be as simple as:

{{{
diff --git a/django/test/runner.py b/django/test/runner.py
index f187107157..c975ed92be 100644
--- a/django/test/runner.py
+++ b/django/test/runner.py
@@ -652,7 +652,8 @@ class DiscoverRunner:
         # _FailedTest objects include things like test modules that couldn't be
         # found or that couldn't be loaded due to syntax errors.
         test_types = (unittest.loader._FailedTest, *self.reorder_by)
-        all_tests = reorder_tests(all_tests, test_types, self.reverse)
+        all_tests = list(reorder_tests(all_tests, test_types, self.reverse))
+        if self.verbosity >= 1:
+            print('Found %d tests' % len(all_tests))
         suite = self.test_suite(all_tests)
 
         if self.parallel > 1:
}}}

If there is any concern about adding an additional message, another possibility would be to display the current ""Testing against Django installed in ..."" message later in the test run, only after the number of tests is known, and include the test count in that message.
"	Cleanup/optimization	closed	Testing framework	dev	Normal	fixed	DiscoverRunner,build_suite		Ready for checkin	1	0	0	0	1	0
