I have two functions
def complex_func():
# generate result.csv
def post_process_func(csv_fname):
# do something with result.csv
and I want to make a unittest for each function
def test_complex_func():
complex_func()
assert result.csv exists
assert contents of result.csv is correct
However, to test post_process_func
I need a result.csv so I need to call complex_func()
and it causes dependency issue between two unittests.
I searched and found mock
or patch
but those are useful to override the return value of function or object, not the file IO.
What's the best way to separate these two unittests in python way?