def test_not_called(self): fn = Mock() pool = Mock(queue=[]) pool.run.side_effect = pool.queue.append plugin = Mock(url=0, uuid=2, pool=pool) _fn = attach(fn) _fn(plugin) call = pool.queue[0] call() plugin.pool.run.assert_called_once_with(ANY) self.assertFalse(fn.called)