Opened 6 years ago

Closed 6 years ago

#16196 closed Cleanup/optimization (fixed)

Redundant or incorrect code in tests

Reported by: Dmitry Jemerov Owned by: melinath
Component: Uncategorized Version: master
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 6 years ago.
16196_fixed.diff (11.7 KB) - added by melinath 6 years ago.

Download all attachments as: .zip

Change History (10)

Changed 6 years ago by Dmitry Jemerov

Attachment: 16196.diff added

comment:1 Changed 6 years ago by Dmitry Jemerov

Cc: Dmitry Jemerov added

comment:2 Changed 6 years ago by Ernesto Rico-Schmidt

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

comment:3 Changed 6 years ago by trez

Triage Stage: UnreviewedAccepted

Small improvements and clarification are always welcome, I think.

comment:4 Changed 6 years ago by Aymeric Augustin

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 Changed 6 years ago by melinath

Owner: changed from nobody to melinath
Status: newassigned

Changed 6 years ago by melinath

Attachment: 16196_fixed.diff added

comment:6 Changed 6 years ago by melinath

Patch needs improvement: unset
Version: 1.3SVN

Made the fixes suggested by aaugustin.

comment:7 Changed 6 years ago by Julien Phalip

Triage Stage: AcceptedReady for checkin

comment:8 Changed 6 years ago by Luke Plant

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