Bug#848249: diffoscope: set_locale needs to call tzset
Brett Smith
debbug at brettcsmith.org
Thu Dec 15 21:20:03 UTC 2016
So the whole thing with the set_locale test fixture is a little subtle. The
best reference I found for this is
<http://doc.pytest.org/en/latest/fixture.html#autouse-fixtures-xunit-setup-on-steroids>.
Before I touched this, the autouse=True argument meant it applied to all
other fixtures in the same utils module as it. In systems where the bug
could occur, the test_gzip metadata test would fail, because the timezone
wasn't necessarily set when python-magic generated a timestamp string for
the gzip1 and gzip2 fixtures.
With my first patch, importing set_locale into the test_gzip module,
combined with autouse=True, meant that it now applied to all the tests and
fixtures in that module too. This made the tests reliable by making sure
the gzip1 and gzip2 fixtures always rendered a timestamp in UTC.
If you want to make sure it runs before any test, we can do that too. I've
attached a patch for that as well.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-tests-Ensure-set_locale-fixture-runs-before-all-test.patch
Type: text/x-diff
Size: 1320 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/reproducible-builds/attachments/20161215/f8cf4234/attachment.patch>
More information about the Reproducible-builds
mailing list