Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information