This has nothing to do with the method being outside of the test; Python makes no such distinction. However your syntax for mocking is consult wrong: you need to reference the thing you want to mock via a Python module path, not a file path.