file_path = base_path + '/Report/report.html' with open(file_path, 'wb') as f: runner = HTMLTestRunner.HTMLTestRunner(stream=f, title="this is test", description="Mushishi test") runner.run(add_case()) f.close()