> Your way would create variables scope local to the mock method only, so there would be no way of checking them later in the test.
A bit of a hack, but, one way around this is to create a locally-scoped dict which the mocked function can mutate.
monitored = dict(notified=False) def fake_notify(): monitored['notified'] = True
self.assertTrue(monitored['notified])
(* Neutral on whether it should be used in this case *)
« Back to merge proposal
> Your way would create variables scope local to the mock method only, so there would be no way of checking them later in the test.
A bit of a hack, but, one way around this is to create a locally-scoped dict which the mocked function can mutate.
monitored = dict(notified= False) 'notified' ] = True
def fake_notify():
monitored[
self.assertTrue (monitored[ 'notified] )
(* Neutral on whether it should be used in this case *)