Hacker News new | ask | show | jobs
by jabwork 2507 days ago
The os module ships with python, so the function call mocking os.listdir will always succeed even if the code being tested does not use os.listdir

By mocking mymodule.os.listdir you add a requirement that mymodule actually import the os module and take advantage of mock.patch failing loudly if it does not.