if __name__ == '__main__':
    test_data.init_data()
    dir1 = os.path.dirname(__file__)
    now = time.strftime("%Y-%m-%d %H:%M:%S")
    filename = dir1+'/report/' + now + '_result.html'
    fp = open(filename, 'wb')
    runner = HTMLTestRunner(
        stream=fp,
        title='test report',
        description='Implementation Example with:'
    )
    runner.run(discover)
    fp.close()

OSError: [Errno 22] Invalid argument: 'C:/Users/js/Desktop/guest-master/frame/report/2017-07-21 09:02:53_result.html'

在文件路径的地方我尝试过用相对路径,然后换成绝对路径。但是都无法解决这个问题。有没有朋友能给点解决方案


↙↙↙阅读原文可查看相关链接,并与作者交流