canonical / bundle-kubeflow

Charmed Kubeflow
Apache License 2.0
99 stars 48 forks source link

Add datetime and file:linenumber to pytest terminal logs #762

Open ca-scribner opened 9 months ago

ca-scribner commented 9 months ago

Why it needs to get done

Sometimes it is useful to have date/time and file/linenumber in pytest logs, for example when debugging race conditions or generally understanding test logs. We should add this to our pytest log output

What needs to get done

Implement something like suggested here in our pyproject.toml files. Their suggestion yields output like:

$ pytest test_spam.py
=============================== test session starts ================================
platform darwin -- Python 3.6.4, pytest-3.7.0, py-1.5.3, pluggy-0.7.1 -- /Users/hoefling/.virtualenvs/stackoverflow/bin/python3.6
cachedir: .pytest_cache
rootdir: /Users/hoefling/projects/private/stackoverflow/so-4673373, inifile: pytest.ini
collected 1 item

test_spam.py::test_eggs
---------------------------------- live log call -----------------------------------
2018-08-01 14:33:20 [    INFO] eggs info (test_spam.py:7)                <----------THESE
2018-08-01 14:33:20 [ WARNING] eggs warning (test_spam.py:8)             <----------THESE
2018-08-01 14:33:20 [   ERROR] eggs error (test_spam.py:9)               <----------THESE
2018-08-01 14:33:20 [CRITICAL] eggs critical (test_spam.py:10)           <----------THESE
PASSED                                                                        [100%]

============================= 1 passed in 0.01 seconds =============================

which I personally think is a good format, but this could be modified as seen fit during implementation

When is the task considered done

syncronize-issues-to-jira[bot] commented 9 months ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/KF-5055.

This message was autogenerated