Skip to content

pytest 8 emits timestamp in ISO format with TZ, choking LocalDateTime in TestSuite #1923

@colindean

Description

@colindean

I'm seeing this in my test results upload:

Error publishing results to Projektor server https://projektor.mycompany.com Request failed with status code 400
Error from server Problem parsing test results: Cannot deserialize value of type `java.time.LocalDateTime` from String "2025-08-28T20:34:02.247682+00:00": Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParseException) Text '2025-08-28T20:34:02.247682+00:00' could not be parsed, unparsed text found at index 26
 at [Source: (StringReader); line: 3, column: 45] (through reference chain: projektor.parser.model.TestSuitesWrapper["testsuites"]->java.util.ArrayList[0]->projektor.parser.model.TestSuites["testsuite"]->java.util.ArrayList[0]->projektor.parser.model.TestSuite["timestamp"])

This leads me to:

java.time.LocalDateTime cannot handle timezones, i.e. the +00:00.

I'm uploading results generated using pytest v8.

pytest up to 8.2 did not include the timezone, but pytest v8.3 added it.

8.2.2:

https://github.com/pytest-dev/pytest/blob/329d3712146e69c471be3e30883d54bdde2f76cb/src/_pytest/junitxml.py#L674

8.3.0:

https://github.com/pytest-dev/pytest/blob/a7d5a8eba9addd119432fa71880b51052a89812f/src/_pytest/junitxml.py#L668-L670

This was done in pytest-dev/pytest@0ed2d79.

Projektor needs to be able to handle a TZ in the timestamp, it seems, in order to continue working with modern pytest versions, as there's no way in pytest to alter this behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions