kaste / mockito-python

Mockito is a spying framework
MIT License
123 stars 12 forks source link

Unstub singleton methods exposed as module functions #54

Closed kaste closed 2 years ago

kaste commented 2 years ago

Fixes #53

The library module random exposes as its main API "functions" on the module level which are actually bound methods detached from a singleton Random() instance.

If a user mocked these, for example random.randint, these were not restored correctly on unstub but deleted.

We hotfix here by adding another check (ismodule).