I'm trying to find a pattern which will allow me to test part of the functionality of my main() function:
def main():
do_a()
download_file()
do_b()
do_c()
do_d()
I'd like to have a test that asserts that the flow up until (and including) the download_file is working correctly.
One obvious way to do so would be to pass a test_name as a parameter and have a logic like:
if test_name == 'download_file':
return
but I'd like to avoid mixing testing logic inside production code.
Another option would be to mock the functions do_b, do_c, and do_d but then if there are lots like so, it's neither elegant nor maintainable to mock all of them.
Thanks for any insight.
Aucun commentaire:
Enregistrer un commentaire