python3.9 + pytest 报错 “INTERNALERROR> Traceback (most recent call last):”看看这是什么问题引起的呢?

以下是脚本


import pytest

class TestFeng():

    def test_0001(self):
        print("test_0001")

    def test_0002(self):
        print("test_0002")

if __name__ == '__main__':
    pytest.main(['-s','testfengkong.py'])

报错信息
C:\Python\Python38\python.exe D:/Users/Administrator/PycharmProjects1/xianneng/testcase/testfengkong.py
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "C:\Python\Python38\lib\site-packages_pytest\main.py", line 265, in wrap_session
INTERNALERROR> config.do_configure()
INTERNALERROR> File "C:\Python\Python38\lib\site-packages_pytest\config_init
.py", line 982, in _do_configure
INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR> File "C:\Python\Python38\lib\site-packages\pluggy_hooks.py", line 277, in call_historic
INTERNALERROR> res = self._hookexec(self.name, self.get_hookimpls(), kwargs, False)
INTERNALERROR> File "C:\Python\Python38\lib\site-packages\pluggy_manager.py", line 80, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> File "C:\Python\Python38\lib\site-packages\pluggy_callers.py", line 60, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "C:\Python\Python38\lib\site-packages\pluggy_result.py", line 60, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "C:\Python\Python38\lib\site-packages\pluggy_callers.py", line 39, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "C:\Python\Python38\lib\site-packages_pytest\logging.py", line 518, in pytest_configure
INTERNALERROR> config.pluginmanager.register(LoggingPlugin(config), "logging-plugin")
INTERNALERROR> File "C:\Python\Python38\lib\site-packages_pytest\logging.py", line 552, in init
INTERNALERROR> self.log_file_handler = FileHandler(log_file, mode="w", encoding="UTF-8")
INTERNALERROR> File "C:\Python\Python38\lib\logging_init
.py", line 1143, in init
INTERNALERROR> StreamHandler.init(self, self.open())
INTERNALERROR> File "C:\Python\Python38\lib\logging_init
.py", line 1172, in _open
INTERNALERROR> return open(self.baseFilename, self.mode, encoding=self.encoding)
INTERNALERROR> FileNotFoundError: [Errno 2] No such file or directory: '\\.\nul'

Process finished with exit code 0

img

img

1.pip uninstall pytest
2.pip install pytest==5.3.0 表示指定安装Pytest版本为5.3.0版本
3.重启pycharm 完美解决问题
4.pip list 是显示当前所有的依赖包

语法正确吗,私信我,帮你看看