[Django] #34810: Calculate coverage on subprocesses such as django-admin commands

6 views
Skip to first unread message

Django

unread,
Sep 2, 2023, 9:05:11 AM9/2/23
to django-...@googlegroups.com
#34810: Calculate coverage on subprocesses such as django-admin commands
------------------------------------------------+------------------------
Reporter: Jacob Walls | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Other) | Version: dev
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 |
------------------------------------------------+------------------------
Noticed during #34778 that despite good coverage for the django-admin
commands in `tests/admin_scripts`, the coverage report suggests only 12%
coverage for `django/core/management/templates.py`.

This is because using coverage.py to trace code launched by a subprocess
(and not through multiprocessing) requires
[https://coverage.readthedocs.io/en/stable/subprocess.html additional
configuration], e.g. adding code to sitecustomize.py or creating a .pth
file.

Perhaps we could look into creating a tempdir with a .pth file to run the
needed coverage.py configuration while running tests.

--
Ticket URL: <https://code.djangoproject.com/ticket/34810>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 4, 2023, 6:42:31 AM9/4/23
to django-...@googlegroups.com
#34810: Calculate coverage on subprocesses such as django-admin commands
--------------------------------------+------------------------------------

Reporter: Jacob Walls | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Other) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* stage: Unreviewed => Accepted


Comment:

Tentatively accepted (not sure if this is doable).

--
Ticket URL: <https://code.djangoproject.com/ticket/34810#comment:1>

Django

unread,
Sep 4, 2023, 12:25:07 PM9/4/23
to django-...@googlegroups.com
#34810: Calculate coverage on subprocesses such as django-admin commands
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned

Component: Core (Other) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* owner: nobody => Jacob Walls
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/34810#comment:2>

Django

unread,
Sep 4, 2023, 12:39:34 PM9/4/23
to django-...@googlegroups.com
#34810: Calculate coverage on subprocesses such as django-admin commands
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/17226 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/34810#comment:3>

Django

unread,
Sep 6, 2023, 8:40:36 AM9/6/23
to django-...@googlegroups.com
#34810: Calculate coverage on subprocesses such as django-admin commands
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* needs_better_patch: 0 => 1


Comment:

Setting as patch needs improvement since apparently the coverage config
should set `parallel` to True.

--
Ticket URL: <https://code.djangoproject.com/ticket/34810#comment:4>

Django

unread,
Sep 6, 2023, 7:07:48 PM9/6/23
to django-...@googlegroups.com
#34810: Calculate coverage on subprocesses such as django-admin commands
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 1 => 0


Comment:

Thanks for the review. Left a comment with what I found about the
`concurrency` option taking the place of the `parallel` option.

--
Ticket URL: <https://code.djangoproject.com/ticket/34810#comment:5>

Django

unread,
Sep 7, 2023, 4:33:52 PM9/7/23
to django-...@googlegroups.com
#34810: Calculate coverage on subprocesses such as django-admin commands
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/34810#comment:6>

Django

unread,
Sep 7, 2023, 4:44:36 PM9/7/23
to django-...@googlegroups.com
#34810: Calculate coverage on subprocesses such as django-admin commands
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: closed

Component: Core (Other) | Version: dev
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia <124304+nessita@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"1ab2cf7994a6f1116a96fbaedd7cadbd4b754179" 1ab2cf79]:
{{{
#!CommitTicketReference repository=""
revision="1ab2cf7994a6f1116a96fbaedd7cadbd4b754179"
Fixed #34810 -- Measured test coverage on django-admin commands.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34810#comment:7>

Reply all
Reply to author
Forward
0 new messages