Opened 4 years ago

Last modified 15 months ago

#32602 closed Cleanup/optimization

Clarify wording re: parallel testing and test case vs. test case class — at Initial Version

Reported by: Chris Jerdonek Owned by: nobody
Component: Documentation Version: 3.1
Severity: Normal Keywords:
Cc: Natalia Bidart Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Currently, there are some places in the docs, code, and code comments that aren't quite clear or right in the way they talk about parallel testing as it relates to test cases versus test case classes.

For example, here in the docs:
https://docs.djangoproject.com/en/3.1/topics/testing/advanced/#django.test.runner.DiscoverRunner
it says:

If there are fewer test cases than configured processes, Django will reduce the number of processes accordingly.

But it should say, "If there are fewer test case classes than configured processes."

Similarly, this code comment:
https://github.com/django/django/blob/41850eec99366a51f98123f7c51e5bc5a8b2798c/django/test/runner.py#L653-L654
should say:

# Since tests are distributed across processes on a per-TestCase
# *class* basis, there's no need for more processes than TestCase
# *classes*.

And also, partition_suite_by_case():
https://github.com/django/django/blob/41850eec99366a51f98123f7c51e5bc5a8b2798c/django/test/runner.py#L845
should really be called something like partition_suite_by_class() or partition_suite_by_test_class() since it groups by type, and the docstring updated accordingly.

I think this is subtle but important because, without being clear, it's easy for people to mistakenly think that the parallel test runner is parallelizing individual test cases, when it's really distributing out the test cases grouped by class.

Change History (0)

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