Opened 4 years ago

Closed 4 years ago

#16196 closed Cleanup/optimization (fixed)

Redundant or incorrect code in tests

Reported by: intelliyole Owned by: melinath
Component: Uncategorized Version: master
Severity: Normal Keywords:
Cc: intelliyole 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 intelliyole 4 years ago.
16196_fixed.diff (11.7 KB) - added by melinath 4 years ago.

Download all attachments as: .zip

Change History (10)

Changed 4 years ago by intelliyole

comment:1 Changed 4 years ago by intelliyole

  • Cc intelliyole added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 4 years ago by nnrcschmdt

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

comment:3 Changed 4 years ago by trez

  • Triage Stage changed from Unreviewed to Accepted

Small improvements and clarification are always welcome, I think.

comment:4 Changed 4 years ago by aaugustin

  • 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 4 years ago by melinath

  • Owner changed from nobody to melinath
  • Status changed from new to assigned

Changed 4 years ago by melinath

comment:6 Changed 4 years ago by melinath

  • Patch needs improvement unset
  • Version changed from 1.3 to SVN

Made the fixes suggested by aaugustin.

comment:7 Changed 4 years ago by julien

  • Triage Stage changed from Accepted to Ready for checkin

comment:8 Changed 4 years ago by lukeplant

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

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