Preface
The html report generated by hrun command, although the use case is passed, check the details to find a large number of reported errors OSError: [WinError 6] Handle invalid.
Problem Description
System environment.
1.windows 10
2.python3.6.6
3.httprunner 3.1.4
4.pytest 5.4.3
5.pytest-html 2.1.1
Problem Description: Using hrun to run the use case, checking the details found a bunch of errors reporting OSError: [WinError 6] Invalid handle.
>hrun testcases/login_userinfo_test.py –html=. /reports/result.html –self-contained-html
Generated html content
——————————Captured stderr call——————————
— Logging error in Loguru Handler #0 —
Record was: {‘elapsed’: datetime.timedelta(0, 1, 859895), ‘exception’: None, ‘extra’: {},
‘file’: (name=’runner.py’, path=’e:\\python36\\lib\\site-packages\\httprunner\\runner.py’),
‘function’: ‘test_start’, ‘level’: (name=’INFO’, no=20, icon=’ℹ️’), ‘line’: 451,
‘message’: ‘Start to run testcase: logincase, TestCase ID: e6171c86-3f61-442d-842e-a6f6b105aba6’,
‘module’: ‘runner’, ‘name’: ‘httprunner.runner’, ‘process’: (id=10728, name=’MainProcess’),
‘thread’: (id=15200, name=’MainThread’), ‘time’: datetime(2021, 6, 16, 21, 15, 14, 919264, tzinfo=datetime.timezone(datetime.timedelta(0, 28800), ‘?D1¨²¡À¨º¡Á?¨º¡À??’))}
Traceback (most recent call last):
File “e:\python36\lib\site-packages\loguru\_handler.py”, line 177, in emit
self._sink.write(str_record)
File “e:\python36\lib\site-packages\loguru\_simple_sinks.py”, line 26, in write
self._stream.write(message)
File “e:\python36\lib\site-packages\colorama\ansitowin32.py”, line 41, in write
self.__convertor.write(text)
File “e:\python36\lib\site-packages\colorama\ansitowin32.py”, line 162, in write
self.write_and_convert(text)
File “e:\python36\lib\site-packages\colorama\ansitowin32.py”, line 187, in write_and_convert
self.write_plain_text(text, cursor, start)
File “e:\python36\lib\site-packages\colorama\ansitowin32.py”, line 196, in write_plain_text
self.wrapped.flush()
OSError: [WinError 6] The handle is invalid.
— End of logging error —
Solution:
The hrun execution pytest use case is not perfect, so instead use pytest to execute the py script
>pytest testcases/login_userinfo_test.py –html=. /reports/result.html –self-contained-html
After re-running the report, the problem was solved
Read More:
- Notes on atom editor_ (11) Editor previews HTML page in real time (add in: atom HTML preview)
- Markdownpad2 Error: Html Rendering Error (An error occurred with the Html rendering component.)
- [Go] Solve the garbled content sent by go-smtp and the unparsed html mail sent
- [Solved] jinja2.exceptions.TemplateNotFound: index.html
- [Solved] Angular12 ng build Error: Index html generation failed.
- [Solved] spring boot security Start Error: ‘login.html?error‘ is not a valid redirect URL
- Tensorflow Run Error or the interface is stuck or report error: Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR
- [Solved] HTML_Uncaught SyntaxError: Cannot use import statement outside a module
- Swagger-ui.html Open Error: There was an unexpected error (type=Not Found, status=404)
- Zeal Open html,css, javascript Error: Content rendering error
- [Solved] Qt Vtk wglMakeCurrent failed in MakeCurrent(), error: The handle is invalid.
- [Solved] OpenGL PowerVR SDK Compiling Error: Could NOT find X11 (missing: X11_X11_INCLUDE_PATH X11_X11_LIB)
- Error Report of Yarn Create UMI
- The problem of using GB2312 encoding in .NET Core to report errors
- Installation and error report of tensorflow
- How to Solve Pydicom Read Dicom File Error: OSError
- [Solved] Rocketmq console connect to x.x.x.x:10911 failed Error
- CARLA Report an Error: rpc server [How to Solve]
- Win7 start apache-activemq error report and solutions
- Report Duplicate keys detected: ‘0’. This may cause an update error in VUE and the solution