Commit 231d782
uploader: make
Summary:
Follow-up to tensorflow#2978, which added explicit configuration of `TZ=UTC`. In
cPython 3, the time zone used by `datetime.datetime.fromtimestamp` is
[cached when `time` is imported][1] unless explicitly reset, so mocking
the environment variable is no longer sufficient. We now call `tzset`
ourselves; we could also just set `TZ=UTC` before importing `datetime`,
but this seems cleaner.
[1]: https://github.com/python/cpython/blob/2528a6c3d0660c03ae43d796628462ccf8e58190/Modules/timemodule.c#L1752-L1763
Test Plan:
A test sync shows that this test passes in both Python 2 and Python 3,
whereas it previously only passed in Python 2.
wchargin-branch: util-test-tzsetutil_test py3-compatible internally (tensorflow#3179)1 parent 1a7dade commit 231d782
1 file changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
208 | 209 | | |
209 | 210 | | |
210 | 211 | | |
211 | | - | |
212 | | - | |
213 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
214 | 219 | | |
215 | 220 | | |
216 | 221 | | |
| |||
0 commit comments