pytest执行测试用例时报如下错误

(python) D:\study\python\BasicKnowledgePoints\s5_frame\f01_pytest\f004_conftest>pytest test_01.py
ImportError while loading conftest 'D:\study\python\BasicKnowledgePoints\s5_frame\f01_pytest\f004_conftest\conftest.py'.
ValueError: source code string cannot contain null bytes

原因是 我的 D:\study\python\BasicKnowledgePoints\s5_frame\f01_pytest\下的 init.py文件中出现乱码,将__init__.py文件删除,重新建一个__init__.py 即可。

更多推荐