Opened 6 years ago

Closed 5 years ago

#2754 closed enhancement (fixed)

Remove mock.assert_called everywhree

Reported by: dustin Owned by: dustin
Priority: minor Milestone: 0.9.+
Version: 0.8.8 Keywords: simple, tests
Cc:

Description

Mock doesn't have an 'assert_called' method, so calling that method in a test will always succeed, leading to useless tests.

Seek and destroy calls to the method, and replace them with assert_called_with(). For bonus points, monkey-patch mock.Mock so that calling assert_called will always fail.

I don't think we should make assert_called do what it says, because that will encourage bad habits which developers might apply in other contexts.

Change History (5)

comment:1 Changed 5 years ago by dustin

  • Milestone changed from 0.8.+ to 0.9.+

Ticket retargeted after milestone closed

comment:2 Changed 5 years ago by Dustin J. Mitchell <dustin@…>

In 0009e45dae908e8eb1f619461fd7567cc5cb973a:

remove an instance of the bogus mock.assert_called

Refs #2754.

comment:3 Changed 5 years ago by dustin

Leaving open for the bonus points.

comment:4 Changed 5 years ago by dustin

  • Owner set to dustin
  • Status changed from new to assigned

bonus points were implemented about a week ago.

comment:5 Changed 5 years ago by dustin

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.