Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#10667 closed (fixed)

Test failure in regressiontests.templates.tests.Templates

Reported by: Glenn Maynard Owned by: nobody
Component: Template system Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Straightforward test failure in r10222 with 2.5:

ERROR: test_templates (regressiontests.templates.tests.Templates)
Traceback (most recent call last):
  File "/home/glenn/django/tests/regressiontests/templates/", line 212, in test_templates
    exc_type, exc_value, exc_tb = sys.exc_info()
NameError: global name 'sys' is not defined

Attachments (1)

fix-template-test.diff (382 bytes) - added by Glenn Maynard 8 years ago.

Download all attachments as: .zip

Change History (8)

Changed 8 years ago by Glenn Maynard

Attachment: fix-template-test.diff added

comment:1 Changed 8 years ago by Alex Gaynor

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

This runs fine for me under 2.5. Can you provide some more details?

comment:2 Changed 8 years ago by Glenn Maynard

                except Exception:
                    exc_type, exc_value, exc_tb = sys.exc_info()
                    if exc_type != result:
                        tb = '\n'.join(traceback.format_exception(exc_type, exc_value, exc_tb))
                        failures.append("Template test (TEMPLATE_STRING_IF_INVALID='%s'): %s -- FAILED. Got %s, exception: %s\n%s" % (invalid_str, name, exc_type, exc_value, tb))

sys.exc_info is being used, and sys isn't being imported. Can you check:

  • Is this code path being reached for you? (If not, something about this test has a nondeterministic code path, which is probably a bug.)
  • If so, then where is the sys module being imported for you?

comment:3 Changed 8 years ago by Alex Gaynor

No it doesn't hit that code path for me, but sys is clearly used there and not imported so we should just add the import.

comment:4 Changed 8 years ago by Alex Gaynor

milestone: 1.1
Triage Stage: UnreviewedReady for checkin

comment:5 Changed 8 years ago by Gary Wilson

Resolution: fixed
Status: newclosed

(In [10244]) Fixed #10667 -- Added missing sys import.

comment:6 Changed 8 years ago by Gary Wilson

(In [10245]) [1.0.X]: Fixed #10667 -- Added missing sys import.

Backport of r10244 from trunk.

comment:7 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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