Opened 7 years ago

Closed 7 years ago

#28360 closed Bug (fixed)

DebugSQLTextTestResult.printErrorList crashes on subTest failure

Reported by: Sergey Fedoseev Owned by: Sergey Fedoseev
Component: Testing framework Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

tests/test_subtest.py:

from django.test import TestCase

class TestSubTest(TestCase):

    def test(self):
        with self.subTest():
            self.assertTrue(False)

python  tests/runtests.py  --debug-sql test_subtest                                                                                                                                            1 ↵
Testing against Django installed in '/home/sergey/dev/django/django' with up to 4 processes
Creating test database for alias 'default'...
Creating test database for alias 'other'...
System check identified no issues (0 silenced).

Traceback (most recent call last):
  File "tests/runtests.py", line 478, in <module>
    options.exclude_tags,
  File "tests/runtests.py", line 286, in django_tests
    extra_tests=extra_tests,
  File "/home/sergey/dev/django/django/test/runner.py", line 604, in run_tests
    result = self.run_suite(suite)
  File "/home/sergey/dev/django/django/test/runner.py", line 570, in run_suite
    return runner.run(suite)
  File "/usr/lib/python3.5/unittest/runner.py", line 183, in run
    result.printErrors()
  File "/usr/lib/python3.5/unittest/runner.py", line 110, in printErrors
    self.printErrorList('FAIL', self.failures)
  File "/home/sergey/dev/django/django/test/runner.py", line 60, in printErrorList
    for test, err, sql_debug in errors:
ValueError: not enough values to unpack (expected 3, got 2)

Change History (5)

comment:1 by Sergey Fedoseev, 7 years ago

Owner: changed from nobody to Sergey Fedoseev
Status: newassigned

comment:2 by Sergey Fedoseev, 7 years ago

Component: UncategorizedTesting framework

comment:3 by Sergey Fedoseev, 7 years ago

Has patch: set

comment:4 by Tim Graham, 7 years ago

Triage Stage: UnreviewedAccepted

comment:5 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In 6de2930:

Fixed #28360 -- Fixed test runner crash with --debug-sql on fail/error in subTest.

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