[Django] #24667: Some tests in model_field suite don't actually do anything

14 views
Skip to first unread message

Django

unread,
Apr 20, 2015, 8:10:09 AM4/20/15
to django-...@googlegroups.com
#24667: Some tests in model_field suite don't actually do anything
-----------------------------------+--------------------
Reporter: yoongkang | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.8
Severity: Normal | Keywords: tests
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------
I ran the model_fields test suite. In this suite there is a test called
test_cardinality_m2m.

The test is supposed to iterate through a collection of fields and run
some tests on each field in the collection.

These asserts never actually get called because the collection is empty.

To reproduce, simply run the following:

PYTHONPATH=..$PYTHONPATH ./runtests.py model_fields

The other tests in model_fields look like they may have the same problem.

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

Django

unread,
Apr 20, 2015, 8:17:40 AM4/20/15
to django-...@googlegroups.com
#24667: Some tests in model_field suite don't actually do anything
-----------------------------------+------------------------------------

Reporter: yoongkang | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.8
Severity: Normal | Resolution:
Keywords: tests | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by bmispelon):

* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* easy: 0 => 1
* stage: Unreviewed => Accepted


Comment:

Hi,

If I understand correctly, the problem is that a generator comprehension
is used so it can only be iterated over once.

We should use a list comprehension instead.

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

Django

unread,
Apr 20, 2015, 8:23:08 AM4/20/15
to django-...@googlegroups.com
#24667: Some tests in model_field suite don't actually do anything
-----------------------------------+-------------------------------------
Reporter: yoongkang | Owner: yoongkang
Type: Bug | Status: assigned

Component: Testing framework | Version: 1.8
Severity: Normal | Resolution:
Keywords: tests | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------------+-------------------------------------
Changes (by yoongkang):

* owner: nobody => yoongkang
* status: new => assigned


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

Django

unread,
Apr 20, 2015, 8:49:28 AM4/20/15
to django-...@googlegroups.com
#24667: Some tests in model_field suite don't actually do anything
-----------------------------------+-------------------------------------
Reporter: yoongkang | Owner: yoongkang
Type: Bug | Status: assigned
Component: Testing framework | Version: 1.8
Severity: Normal | Resolution:
Keywords: tests | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* has_patch: 0 => 1


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

Django

unread,
Apr 20, 2015, 9:41:41 AM4/20/15
to django-...@googlegroups.com
#24667: Some tests in model_field suite don't actually do anything
-----------------------------------+-------------------------------------
Reporter: yoongkang | Owner: yoongkang
Type: Bug | Status: closed

Component: Testing framework | Version: 1.8
Severity: Normal | Resolution: fixed

Keywords: tests | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

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


Comment:

In [changeset:"36eab95e7fde7fad4368192ddbef4e2dbb32dc91" 36eab95e]:
{{{
#!CommitTicketReference repository=""
revision="36eab95e7fde7fad4368192ddbef4e2dbb32dc91"
Fixed #24667 --- Repaired model_fields cardinality test
}}}

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

Django

unread,
Apr 20, 2015, 9:41:52 AM4/20/15
to django-...@googlegroups.com
#24667: Some tests in model_field suite don't actually do anything
-----------------------------------+-------------------------------------
Reporter: yoongkang | Owner: yoongkang
Type: Bug | Status: closed
Component: Testing framework | Version: 1.8
Severity: Normal | Resolution: fixed
Keywords: tests | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"b8f203b3f27b1dc02ad84b616092bcf03337fc51" b8f203b3]:
{{{
#!CommitTicketReference repository=""
revision="b8f203b3f27b1dc02ad84b616092bcf03337fc51"
[1.8.x] Fixed #24667 --- Repaired model_fields cardinality test

Backport of 36eab95e7fde7fad4368192ddbef4e2dbb32dc91 from master
}}}

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

Reply all
Reply to author
Forward
0 new messages