I'm trying to test the main function that if len (sys. argv) < 1 or len (sys. argv) < 4 it will run a function using pytest
this is my main fucntion
def main():
if len(sys.argv) == 1:
print(print_help())
elif len(sys.argv) == 2 or len(sys.argv) == 3:
if sys.argv[1] == 'help' or sys.argv[1] == 'h' or sys.argv[1] == 'H':
print(print_help())
else:
print('no such command arguments try python project.py help')
def print_help:
the_help = 'the help section'
return the_help
if __name__ =='__main__':
main()
How can I use pytest to test this main function if sys. argv < 1 that it will run the print_help
function
or if sys.argv == 'help' or sys.argv == 'h' or sys.argv == 'H' it will run the same fucntion