Opened 13 years ago

Closed 13 years ago

#16196 closed Cleanup/optimization (fixed)

Redundant or incorrect code in tests

Reported by: Dmitry Jemerov Owned by: Stephen Burrows
Component: Uncategorized Version: dev
Severity: Normal Keywords:
Cc: Dmitry Jemerov 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

Ran a static analysis tool on Django tests, found and fixed several classes of issues:

  • Unnecessary semicolons
  • Unnecessary backslashes
  • Duplicate keys in dictionaries containing testdata (sometimes causing testcases present in the code to be missed)
  • One case of incorrectly inserted line break preventing the execution of an assertion

Attached patch fixing the issues.

Attachments (2)

16196.diff (11.3 KB ) - added by Dmitry Jemerov 13 years ago.
16196_fixed.diff (11.7 KB ) - added by Stephen Burrows 13 years ago.

Download all attachments as: .zip

Change History (10)

by Dmitry Jemerov, 13 years ago

Attachment: 16196.diff added

comment:1 by Dmitry Jemerov, 13 years ago

Cc: Dmitry Jemerov added

comment:2 by Ernesto Rico-Schmidt, 13 years ago

patch complains about carriage return characters: "Stripping trailing CRs from patch."

comment:3 by trez, 13 years ago

Triage Stage: UnreviewedAccepted

Small improvements and clarification are always welcome, I think.

comment:4 by Aymeric Augustin, 13 years ago

Patch needs improvement: set

The tests for 'regroup' in tests/regressiontests/templates/tests.pycould be further simplified by taking advantage of string concatenation; most + signs are useless.

As mentionned by nnrcschmdt, the patch should use \n and not \r\n.

If these two problems are fixed, it's ready for checkin.

comment:5 by Stephen Burrows, 13 years ago

Owner: changed from nobody to Stephen Burrows
Status: newassigned

by Stephen Burrows, 13 years ago

Attachment: 16196_fixed.diff added

comment:6 by Stephen Burrows, 13 years ago

Patch needs improvement: unset
Version: 1.3SVN

Made the fixes suggested by aaugustin.

comment:7 by Julien Phalip, 13 years ago

Triage Stage: AcceptedReady for checkin

comment:8 by Luke Plant, 13 years ago

Resolution: fixed
Status: assignedclosed

In [16354]:

Fixed #16196 - Redundant or incorrect code in tests

Thanks to intelliyole and melinath for the patch.

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