Code

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#10667 closed (fixed)

Test failure in regressiontests.templates.tests.Templates

Reported by: Glenn 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:

Description

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/tests.py", 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 5 years ago.

Download all attachments as: .zip

Change History (8)

Changed 5 years ago by Glenn

comment:1 Changed 5 years ago by Alex

  • 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 5 years ago by Glenn

                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))
                    continue

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 5 years ago by Alex

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 5 years ago by Alex

  • milestone set to 1.1
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:5 Changed 5 years ago by gwilson

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:6 Changed 5 years ago by gwilson

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

Backport of r10244 from trunk.

comment:7 Changed 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.