-
Notifications
You must be signed in to change notification settings - Fork 244
Garbage date-time is printed in the Captured log. #314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Could you provide some more info @pawan7476 ?
It'd be great if you could also provide a minimum reproducible test. Thanks! |
Hi @BeyondEvil, Please find the required details :
Reproducible steps:-
Trigger Pytest runspytest -v --count=1 test_cyclic_switchover.py -m process --html="$REPORT_PATH" console live logs: test_cyclic_switchover.py::test_process_switchover[SCM] pytest-html generated report logs: |
We only support python |
Hi @BeyondEvil , I tried with
But still facing the same issue. |
Thank @pawan7476 Let me try to reproduce. |
You need to add the You can also try using the |
I'm having trouble reproducing this. Could you provide a small test-case/python file (or even a complete repo) to help with reproducing this error? |
Hi @BeyondEvil , Please find all the minimum sample conf , test scripts , run logs attached which will help reproducing the issue. thanks |
I've identified the root cause. The "garbage" that you're seeing are the ANSI color codes for the log levels. See this PR The solution (or workaround 🤔) is to pass |
Ok, I've found a way to handle it properly in the plugin. Please use the workaround for now. |
@BeyondEvil I've tested with your workaround and it helped to stop printing ANSI color codes. My only gripe is that in the pytest-html plugin report captured log, the date time is not captured as it should be like on the console logs. pytest-html captured logs: |
if we capture date-time with logging info for pytest-html plugin captured logs that will be great 💯 Expected: |
The issue is that the information we get from pytest is the Is there an easy way for us to get the https://github.com/pytest-dev/pytest-html/blob/master/pytest_html/plugin.py#L278 So the timestamp is emitted by the python |
It should be possible to configure the logging formatting using the various logging options. Also there should be an option to disable log coloring.
Unfortunately not at the moment, but I believe the two issues above should be fixable. |
I don't think the configuration of the formatting is the issue here, the information coming from the captured logs still contain the ANSI escape sequences, so for the report (when not using ansi2html) we need to strip those out.
Right,
I made an attempt in #315 Is there a better approach? |
That's right, but I mean there should be a separate option just for logging, say |
Can't find any. Even if I could, I'm not sure how it would solve the issue? 🤔 That is, the issue with the ANSI escape sequence in the report. If we even think that is an issue... Sorry, tired, maybe I'm missing something obvious here. |
I just we could suggest users to configure |
@nicoddemus @BeyondEvil , Please let me know if implementation of the above is in the plan. |
Yes, I'll merge the fix and see if I can't make a release this weekend. |
Garbage date-time is printed in the Captured log.
pytest-html report:
------------------------------ Captured log setup ------------------------------
�[32mINFO �[0m root:test_cyclic_switchover.py:26 Inside Setup
�[32mINFO �[0m root:test_cyclic_switchover.py:54
------------------------------ Captured log call -------------------------------
�[32mINFO �[0m root:test_cyclic_switchover.py:82
Switchover Process : SCM
pytest console log :
collected 4 items / 2 deselected / 2 selected
test_cyclic_switchover.py::test_process_switchover[SCM]
------------------------------------------------------------ live log setup -------------------------------------------------------------
2020-07-13 21:51:50 [ INFO] Inside Setup
(test_cyclic_switchover.py:26)
2020-07-13 21:51:50 [ INFO]
(test_cyclic_switchover.py:54)
------------------------------------------------------------- live log call -------------------------------------------------------------
2020-07-13 21:51:50 [ INFO]
Switchover Process : SCM (test_cyclic_switchover.py:82)
PASSED [ 50%]
test_cyclic_switchover.py::test_process_switchover[SAM]
------------------------------------------------------------- live log call -------------------------------------------------------------
2020-07-13 21:51:50 [ INFO]
Switchover Process : SAM (test_cyclic_switchover.py:82)
PASSED [100%]
----------------------------------------------------------- live log teardown -----------------------------------------------------------
2020-07-13 21:51:50 [ INFO] Inside Teardown (test_cyclic_switchover.py:60)
The text was updated successfully, but these errors were encountered: