We have several small scripts in our project that take some command-line arguments. For example:
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--branch")
command_line_args = parser.parse_args()
if not command_line_args.branch:
raise Exception
main(command_line_args.branch)
we are not really interested in unit-test this. However, this impacts our coverage report, is there a way to exclude the if __name__ == "__main__" from unit-tests using pytest?