[Django] #32227: DebugSQLTextTestResult crashes when database error is raised in setUpTestData().

21 views
Skip to first unread message

Django

unread,
Nov 26, 2020, 4:51:36 AM11/26/20
to django-...@googlegroups.com
#32227: DebugSQLTextTestResult crashes when database error is raised in
setUpTestData().
---------------------------------------------+------------------------
Reporter: Mariusz Felisiak | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 3.1
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 |
---------------------------------------------+------------------------
Running `./runtests.py postgres_tests.test_array --debug-sql` with
attached diff crashes:
{{{
./runtests.py postgres_tests.test_array --debug-sql
Testing against Django installed in '/django/django' with up to 4
processes
Creating test database for alias 'default'...
Got an error creating the test database: database "test_djangotest"
already exists

Type 'yes' if you would like to try deleting the test database
'test_djangotest', or 'no' to cancel: yes
Destroying old test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Destroying old test database for alias 'default'...
Cloning test database for alias 'default'...
Destroying old test database for alias 'default'...
System check identified no issues (0 silenced).
EDestroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Traceback (most recent call last):
File "./runtests.py", line 589, in <module>
options.timing,
File "./runtests.py", line 320, in django_tests
extra_tests=extra_tests,
File "/django/django/test/runner.py", line 721, in run_tests
result = self.run_suite(suite)
File "/django/django/test/runner.py", line 662, in run_suite
return runner.run(suite)
File "/usr/lib/python3.6/unittest/runner.py", line 176, in run
test(result)
File "/usr/lib/python3.6/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
File "/django/django/test/runner.py", line 418, in run
handler(test, *args)
File "/django/django/test/runner.py", line 59, in addError
self.debug_sql_stream.seek(0)
AttributeError: 'DebugSQLTextTestResult' object has no attribute
'debug_sql_stream'
}}}

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

Django

unread,
Nov 26, 2020, 4:52:07 AM11/26/20
to django-...@googlegroups.com
#32227: DebugSQLTextTestResult crashes when database error is raised in
setUpTestData().
-----------------------------------+--------------------------------------

Reporter: Mariusz Felisiak | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 3.1
Severity: Normal | Resolution:

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

* Attachment "scenario-32227.diff" added.

Django

unread,
Nov 26, 2020, 4:52:57 AM11/26/20
to django-...@googlegroups.com
#32227: DebugSQLTextTestResult crashes when database error is raised in
setUpTestData().
-----------------------------------+--------------------------------------

Reporter: Mariusz Felisiak | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 3.1
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Description changed by Mariusz Felisiak:

Old description:

New description:

Running `./runtests.py postgres_tests.test_array --debug-sql` with

[https://code.djangoproject.com/attachment/ticket/32227/scenario-32227.diff

--

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

Django

unread,
Nov 26, 2020, 4:53:53 AM11/26/20
to django-...@googlegroups.com
#32227: DebugSQLTextTestResult crashes when database error is raised in
setUpTestData().
-----------------------------------+------------------------------------

Reporter: Mariusz Felisiak | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 3.1
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 Carlton Gibson):

* stage: Unreviewed => Accepted


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

Django

unread,
Nov 26, 2020, 5:11:16 AM11/26/20
to django-...@googlegroups.com
#32227: DebugSQLTextTestResult crashes when database error is raised in
setUpTestData().
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Adam
| (Chainz) Johnson
Type: Bug | Status: assigned

Component: Testing framework | Version: 3.1
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 Adam (Chainz) Johnson):

* owner: nobody => Adam (Chainz) Johnson
* status: new => assigned
* has_patch: 0 => 1


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

Django

unread,
Nov 28, 2020, 6:23:31 AM11/28/20
to django-...@googlegroups.com
#32227: DebugSQLTextTestResult crashes when database error is raised in
setUpTestData().
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Adam
| (Chainz) Johnson
Type: Bug | Status: assigned
Component: Testing framework | Version: 3.1
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 Mariusz Felisiak):

* stage: Accepted => Ready for checkin


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

Django

unread,
Nov 28, 2020, 7:01:04 AM11/28/20
to django-...@googlegroups.com
#32227: DebugSQLTextTestResult crashes when database error is raised in
setUpTestData().
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Adam
| (Chainz) Johnson
Type: Bug | Status: closed

Component: Testing framework | Version: 3.1
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 Mariusz Felisiak <felisiak.mariusz@…>):

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


Comment:

In [changeset:"b9fd09d21b722c3745501151f9cbd5b95ccc3177" b9fd09d2]:
{{{
#!CommitTicketReference repository=""
revision="b9fd09d21b722c3745501151f9cbd5b95ccc3177"
Fixed #32227 -- Prevented crash when setUpTestData() errors with --debug-
sql.

Thanks Mariusz Felisiak for the report.
}}}

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

Reply all
Reply to author
Forward
0 new messages