<div>Hi,</div><div><br></div><div>Suppose I have this piece of code:</div><div><br></div><div>def some_func(parm1, parm2, ....):</div><div>    if os.path.exists(param1):</div><div>          // do a bunch of os operation using shutil, os, and some other custom libraries (hashing, etc)</div>
<div>    return result</div><div><br></div><div>So if I want to write a unittest, I&#39;d mock out os.path.exists and just about everything in this function! That&#39;s testing against implementation rather than the behavioral of the function (does the output matches the expected).</div>
<div>In some cases, I can put everything complex into individual functiosn</div><div><br></div><div>def some_func(parm1, parm2....):</div><div>    func1(..)</div><div>    func2(...)</div><div>    return result</div><div><br>
</div><div>But I still have to test func1 and func2. So at the end of the day, I still have to mock many things out. </div><div><br></div><div>How would do test it? I know I can setup some fixture data like real files, but that&#39;s slow. I might as well just write an integration test and forget about my unittest, but that could run a long time.</div>
<div><br></div><div>Thanks a lot!</div><div><br></div><div>Kate</div>