pytest-dev / pytest-xdist

pytest plugin for distributed testing and loop-on-failures testing modes.
https://pytest-xdist.readthedocs.io
MIT License
1.46k stars 232 forks source link

No timestamp in when failures are printed out #1096

Closed rafalf closed 3 months ago

rafalf commented 3 months ago

For some reason, while all failures are being printed, there's no timestamp logged Would there be any way to get the timestamp in?

pytest.ini

log_cli = true
worker_log_file = pytest-%w.log
log_file_level = INFO
log_file_format = %(asctime)s [%(levelname)s] %(message)s (%(filename)s:%(lineno)s)
log_file_date_format = %Y-%m-%d %H:%M:%S
log_cli_level = INFO
log_cli_format = %(asctime)s [%(levelname)s] %(message)s (%(filename)s:%(lineno)s)
log_cli_date_format = %Y-%m-%d %H:%M:%S

Failure

_____________________________ Test2499092.test_015 _____________________________
tests/abc/test_2499092.py:1539: in test_015
    response = gen.api.create_ABC(prefixed_cdp_name,
resources/api.py:1101: in create_ABC
    assert response.status_code == 200, f"Error. Status code: {response.status_code} and message: " \
E   AssertionError: Error. Status code: 400 and message: {"status": "FAILED", "error": "Entity already exist."}
------------------------------ Captured log call -------------------------------
INFO     root:cache.py:100 Cache out: abc/wam/oceancqt/so/: [{'access_token': 'abc(...)
INFO     root:graphql.py:186 GraphQL query: ......

INFO     root:cache.py:100 Cache out: abc/wam/oceancqt/so/: [{'access_token': 'abc(...)
INFO     root:graphql.py:186 GraphQL query: ... 

INFO     root:cache.py:100 Cache out: abc/abc/: ['abc(...)
INFO     root:api.py:75 Login as generic account: user
INFO     root:api.py:95 Requesting endpoint with POST method: https://abc-abc.abc.abc.com/api/v1/data/storage/login for username: tvrtest8
INFO     root:cache.py:88 Cache in: abc/tvrtest8/: ['abc.eyJzY29(...)
RonnyPfannschmidt commented 3 months ago

the output shows the captured log, not a log file or the cli output

please set log_formatand log_date_formatas well

rafalf commented 3 months ago

the output shows the captured log, not a log file or the cli output

please set log_formatand log_date_formatas well

works like a charm, thanks !