Skip to content
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

Tests fail because of non-deterministic floating-point precision #62

Open
CervEdin opened this issue Sep 25, 2024 · 3 comments
Open

Tests fail because of non-deterministic floating-point precision #62

CervEdin opened this issue Sep 25, 2024 · 3 comments
Assignees

Comments

@CervEdin
Copy link

If I run pytest I get failures because of a what appears to be due to difference in precision in the time= attribute in the xml

<testsuites disabled="0" errors="0" failures="24" tests="65" time="0.019785572146">

and a couple of other places.

What's expected

<testsuites disabled="0" errors="0" failures="24" tests="65" time="0.019785572146">

What I get

<testsuites disabled="0" errors="0" failures="24" tests="65" time="0.019785572145999998">

I suspect this is due to different behaviors in the underlying yamlish and PyYAML dependencies on different platforms.

I don't think it's a big deal that floating-point conversion of TAP to JUnit is non-deterministic on different platforms.
But it's regrettable that the tests of tap2junit relies on this deterministic behavior.

I'm going to take a look and see if I can fix this in a suitable manner, meanwhile I report the issue here.

@cclauss
Copy link
Collaborator

cclauss commented Sep 25, 2024

Is this related to:

@CervEdin
Copy link
Author

@cclauss thanks

Could be, maybe this division by 1000 is the cause for different precision in the floating point number
df57e72#r962286153

🤔

@CervEdin
Copy link
Author

Actually I think this is the culprit

https://github.com/kyrus/python-junit-xml/blob/4bd08a272f059998cedf9b7779f944d49eba13a6/junit_xml/__init__.py#L135

all of the differences are regarding the time of the testsuite element

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants