Opened 4 years ago

Closed 4 years ago

#32227 closed Bug (fixed)

DebugSQLTextTestResult crashes when database error is raised in setUpTestData().

Reported by: Mariusz Felisiak Owned by: Adam Johnson
Component: Testing framework Version: 3.1
Severity: Normal Keywords:
Cc: Adam Johnson Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Mariusz Felisiak)

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'

Attachments (1)

scenario-32227.diff (673 bytes ) - added by Mariusz Felisiak 4 years ago.

Download all attachments as: .zip

Change History (6)

by Mariusz Felisiak, 4 years ago

Attachment: scenario-32227.diff added

comment:1 by Mariusz Felisiak, 4 years ago

Description: modified (diff)

comment:2 by Carlton Gibson, 4 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Adam Johnson, 4 years ago

Has patch: set
Owner: changed from nobody to Adam Johnson
Status: newassigned
Last edited 4 years ago by Mariusz Felisiak (previous) (diff)

comment:4 by Mariusz Felisiak, 4 years ago

Triage Stage: AcceptedReady for checkin

comment:5 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In b9fd09d2:

Fixed #32227 -- Prevented crash when setUpTestData() errors with --debug-sql.

Thanks Mariusz Felisiak for the report.

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