[Django] #25062: assertNoWriteQueries Assertion

23 views
Skip to first unread message

Django

unread,
Jul 4, 2015, 11:53:44 PM7/4/15
to django-...@googlegroups.com
#25062: assertNoWriteQueries Assertion
-----------------------------------+--------------------------------------
Reporter: frewsxcv | Owner: nobody
Type: New feature | Status: new
Component: Testing framework | Version: master
Severity: Normal | Keywords: testing assert assertion
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Similar to:

https://docs.djangoproject.com/en/1.8/topics/testing/tools/#django.test.TransactionTestCase.assertNumQueries

It would make sure no databases get written to within the block.

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

Django

unread,
Jul 5, 2015, 7:52:07 AM7/5/15
to django-...@googlegroups.com
#25062: assertNoWriteQueries Assertion
-------------------------------------+-------------------------------------

Reporter: frewsxcv | Owner: nobody
Type: New feature | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: testing assert | Triage Stage:
assertion | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Why not just use this?
{{{
with self.assertNumQueries(0):
# some code
}}}

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

Django

unread,
Jul 6, 2015, 8:49:02 AM7/6/15
to django-...@googlegroups.com
#25062: assertNoWriteQueries Assertion
-------------------------------------+-------------------------------------

Reporter: frewsxcv | Owner: nobody
Type: New feature | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: testing assert | Triage Stage:
assertion | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by timgraham):

I think the distinction here is that read queries are allowed, but not
writes. I'm curious about the use case. There is #22492 which proposes a
way to prohibit queries in a given code block. Perhaps that idea could be
extended to prohibit write queries in a block. That may be less fragile
than a test assertion.

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

Django

unread,
Jul 13, 2015, 5:44:20 PM7/13/15
to django-...@googlegroups.com
#25062: assertNoWriteQueries Assertion
-------------------------------------+-------------------------------------
Reporter: frewsxcv | Owner: nobody
Type: New feature | Status: closed

Component: Testing framework | Version: master
Severity: Normal | Resolution: wontfix

Keywords: testing assert | Triage Stage:
assertion | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

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


Comment:

Closing absent follow up from the reporter.

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

Reply all
Reply to author
Forward
0 new messages