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

Fix XML comparison, compare time within 1e-6 seconds #63

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Sep 25, 2024

  1. Fix XML comparison, compare time within 1e-6 seconds

    There appears to be a difference in how 'time' is generated in the XML
    output, possibly different in different systems/configurations.
    
    Possible culprit is how the 'time' attribute is for 'testsuite' elements.
    https://github.com/kyrus/python-junit-xml/blob/4bd08a272f059998cedf9b7779f944d49eba13a6/junit_xml/__init__.py#L135
    
    Test case attributes appear to be formatted using `'%f' % time`, which
    is 6 decimal places by default.
    
    For the testsuite, it looks like it's just a `str` call and maybe this
    is causing different systems to generate time of different precision.
    
    Due to this small differences in how time is encoded in the XML, the
    test suite may fail due to differences in the amount of precision is
    encoded on the system.
    
    Add a new function to the test suite that compares the XML document
    recursively and assert that tags, text and attributes match.
    
    For 'time' attributes, we compare using `math.isclose()` with a
    tolerance of 1e-6.
    CervEdin committed Sep 25, 2024
    Configuration menu
    Copy the full SHA
    fc89270 View commit details
    Browse the repository at this point in the history