Title: "27 years from now" tests fail on platforms with 32-bit `time_t` (y2k38 problem) · Issue #176 · python-humanize/humanize · GitHub
Open Graph Title: "27 years from now" tests fail on platforms with 32-bit `time_t` (y2k38 problem) · Issue #176 · python-humanize/humanize
X Title: "27 years from now" tests fail on platforms with 32-bit `time_t` (y2k38 problem) · Issue #176 · python-humanize/humanize
Description: What did you do? tox -e py311 on a 32-bit x86 system. What did you expect to happen? Tests passing (possibly by skipping these tests on OverflowError). What actually happened? .pkg: install_requires> python -I -m pip install hatch-vcs ha...
Open Graph Description: What did you do? tox -e py311 on a 32-bit x86 system. What did you expect to happen? Tests passing (possibly by skipping these tests on OverflowError). What actually happened? .pkg: install_require...
X Description: What did you do? tox -e py311 on a 32-bit x86 system. What did you expect to happen? Tests passing (possibly by skipping these tests on OverflowError). What actually happened? .pkg: install_require...
Opengraph URL: https://github.com/python-humanize/humanize/issues/176
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"\"27 years from now\" tests fail on platforms with 32-bit `time_t` (y2k38 problem)","articleBody":"### What did you do?\r\n\r\n`tox -e py311` on a 32-bit x86 system.\r\n\r\n### What did you expect to happen?\r\n\r\nTests passing (possibly by skipping these tests on `OverflowError`).\r\n\r\n### What actually happened?\r\n\r\n```pytb\r\n.pkg: install_requires\u003e python -I -m pip install hatch-vcs hatchling\r\n.pkg: _optional_hooks\u003e python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True hatchling.build\r\n.pkg: get_requires_for_build_sdist\u003e python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True hatchling.build\r\n.pkg: build_sdist\u003e python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True hatchling.build\r\npy311: install_package_deps\u003e python -I -m pip install freezegun pytest pytest-cov\r\npy311: install_package\u003e python -I -m pip install --force-reinstall --no-deps /home/mgorny/humanize/.tox/.tmp/package/1/humanize-4.9.1.dev38.tar.gz\r\npy311: commands[0]\u003e .tox/py311/bin/python -m pytest --cov humanize --cov tests --cov-report html --cov-report term --cov-report xml\r\n========================================================= test session starts =========================================================\r\nplatform linux -- Python 3.11.7, pytest-8.0.2, pluggy-1.4.0\r\ncachedir: .tox/py311/.pytest_cache\r\nrootdir: /home/mgorny/humanize\r\nconfigfile: pyproject.toml\r\nplugins: cov-4.1.0\r\ncollected 572 items \r\n\r\ntests/test_filesize.py .................... [ 3%]\r\ntests/test_i18n.py sssssssssssssssssssssss..... [ 8%]\r\ntests/test_number.py .......................................................................................................... [ 26%]\r\n.......................................................................................................... [ 45%]\r\ntests/test_time.py ............................................................................................................ [ 64%]\r\n............................................................................................................................... [ 86%]\r\n..F......................F................................................... [100%]\r\n\r\n============================================================== FAILURES ===============================================================\r\n______________________________________ test_naturaltime_timezone[test_input19-27 years from now] ______________________________________\r\n\r\ntest_input = FakeDatetime(2047, 6, 20, 0, 0, tzinfo=datetime.timezone.utc), expected = '27 years from now'\r\n\r\n @freeze_time(\"2020-02-02\")\r\n @pytest.mark.parametrize(\r\n \"test_input, expected\",\r\n [\r\n (NOW_UTC, \"now\"),\r\n (NOW_UTC - dt.timedelta(seconds=1), \"a second ago\"),\r\n (NOW_UTC - dt.timedelta(seconds=30), \"30 seconds ago\"),\r\n (NOW_UTC - dt.timedelta(minutes=1, seconds=30), \"a minute ago\"),\r\n (NOW_UTC - dt.timedelta(minutes=2), \"2 minutes ago\"),\r\n (NOW_UTC - dt.timedelta(hours=1, minutes=30, seconds=30), \"an hour ago\"),\r\n (NOW_UTC - dt.timedelta(hours=23, minutes=50, seconds=50), \"23 hours ago\"),\r\n (NOW_UTC - dt.timedelta(days=1), \"a day ago\"),\r\n (NOW_UTC - dt.timedelta(days=500), \"1 year, 4 months ago\"),\r\n (NOW_UTC - dt.timedelta(days=365 * 2 + 35), \"2 years ago\"),\r\n (NOW_UTC + dt.timedelta(seconds=1), \"a second from now\"),\r\n (NOW_UTC + dt.timedelta(seconds=30), \"30 seconds from now\"),\r\n (NOW_UTC + dt.timedelta(minutes=1, seconds=30), \"a minute from now\"),\r\n (NOW_UTC + dt.timedelta(minutes=2), \"2 minutes from now\"),\r\n (NOW_UTC + dt.timedelta(hours=1, minutes=30, seconds=30), \"an hour from now\"),\r\n (NOW_UTC + dt.timedelta(hours=23, minutes=50, seconds=50), \"23 hours from now\"),\r\n (NOW_UTC + dt.timedelta(days=1), \"a day from now\"),\r\n (NOW_UTC + dt.timedelta(days=500), \"1 year, 4 months from now\"),\r\n (NOW_UTC + dt.timedelta(days=365 * 2 + 35), \"2 years from now\"),\r\n # regression tests for bugs in post-release humanize\r\n (NOW_UTC + dt.timedelta(days=10000), \"27 years from now\"),\r\n (NOW_UTC - dt.timedelta(days=365 + 35), \"1 year, 1 month ago\"),\r\n (NOW_UTC - dt.timedelta(days=365 * 2 + 65), \"2 years ago\"),\r\n (NOW_UTC - dt.timedelta(days=365 + 4), \"1 year, 4 days ago\"),\r\n ],\r\n )\r\n def test_naturaltime_timezone(test_input: dt.datetime, expected: str) -\u003e None:\r\n\u003e assert humanize.naturaltime(test_input) == expected\r\n\r\ntests/test_time.py:449: \r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\r\n.tox/py311/lib/python3.11/site-packages/humanize/time.py:249: in naturaltime\r\n value = _convert_aware_datetime(value)\r\n.tox/py311/lib/python3.11/site-packages/humanize/time.py:275: in _convert_aware_datetime\r\n value = dt.datetime.fromtimestamp(value.timestamp())\r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\r\n\r\ncls = \u003cclass 'freezegun.api.FakeDatetime'\u003e, t = 2444601600.0, tz = None\r\n\r\n @classmethod\r\n def fromtimestamp(cls, t, tz=None):\r\n if tz is None:\r\n\u003e return real_datetime.fromtimestamp(\r\n t, tz=dateutil.tz.tzoffset(\"freezegun\", cls._tz_offset())\r\n ).replace(tzinfo=None)\r\nE OverflowError: timestamp out of range for platform time_t\r\n\r\n.tox/py311/lib/python3.11/site-packages/freezegun/api.py:375: OverflowError\r\n___________________________________ test_naturaltime_timezone_when[test_input19-27 years from now] ____________________________________\r\n\r\ntest_input = FakeDatetime(2047, 6, 20, 0, 0, tzinfo=datetime.timezone.utc), expected = '27 years from now'\r\n\r\n @freeze_time(\"2020-02-02\")\r\n @pytest.mark.parametrize(\r\n \"test_input, expected\",\r\n [\r\n (NOW_UTC, \"now\"),\r\n (NOW_UTC - dt.timedelta(seconds=1), \"a second ago\"),\r\n (NOW_UTC - dt.timedelta(seconds=30), \"30 seconds ago\"),\r\n (NOW_UTC - dt.timedelta(minutes=1, seconds=30), \"a minute ago\"),\r\n (NOW_UTC - dt.timedelta(minutes=2), \"2 minutes ago\"),\r\n (NOW_UTC - dt.timedelta(hours=1, minutes=30, seconds=30), \"an hour ago\"),\r\n (NOW_UTC - dt.timedelta(hours=23, minutes=50, seconds=50), \"23 hours ago\"),\r\n (NOW_UTC - dt.timedelta(days=1), \"a day ago\"),\r\n (NOW_UTC - dt.timedelta(days=500), \"1 year, 4 months ago\"),\r\n (NOW_UTC - dt.timedelta(days=365 * 2 + 35), \"2 years ago\"),\r\n (NOW_UTC + dt.timedelta(seconds=1), \"a second from now\"),\r\n (NOW_UTC + dt.timedelta(seconds=30), \"30 seconds from now\"),\r\n (NOW_UTC + dt.timedelta(minutes=1, seconds=30), \"a minute from now\"),\r\n (NOW_UTC + dt.timedelta(minutes=2), \"2 minutes from now\"),\r\n (NOW_UTC + dt.timedelta(hours=1, minutes=30, seconds=30), \"an hour from now\"),\r\n (NOW_UTC + dt.timedelta(hours=23, minutes=50, seconds=50), \"23 hours from now\"),\r\n (NOW_UTC + dt.timedelta(days=1), \"a day from now\"),\r\n (NOW_UTC + dt.timedelta(days=500), \"1 year, 4 months from now\"),\r\n (NOW_UTC + dt.timedelta(days=365 * 2 + 35), \"2 years from now\"),\r\n # regression tests for bugs in post-release humanize\r\n (NOW_UTC + dt.timedelta(days=10000), \"27 years from now\"),\r\n (NOW_UTC - dt.timedelta(days=365 + 35), \"1 year, 1 month ago\"),\r\n (NOW_UTC - dt.timedelta(days=365 * 2 + 65), \"2 years ago\"),\r\n (NOW_UTC - dt.timedelta(days=365 + 4), \"1 year, 4 days ago\"),\r\n ],\r\n )\r\n def test_naturaltime_timezone_when(test_input: dt.datetime, expected: str) -\u003e None:\r\n\u003e assert humanize.naturaltime(test_input, when=NOW_UTC) == expected\r\n\r\ntests/test_time.py:483: \r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\r\n.tox/py311/lib/python3.11/site-packages/humanize/time.py:249: in naturaltime\r\n value = _convert_aware_datetime(value)\r\n.tox/py311/lib/python3.11/site-packages/humanize/time.py:275: in _convert_aware_datetime\r\n value = dt.datetime.fromtimestamp(value.timestamp())\r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\r\n\r\ncls = \u003cclass 'freezegun.api.FakeDatetime'\u003e, t = 2444601600.0, tz = None\r\n\r\n @classmethod\r\n def fromtimestamp(cls, t, tz=None):\r\n if tz is None:\r\n\u003e return real_datetime.fromtimestamp(\r\n t, tz=dateutil.tz.tzoffset(\"freezegun\", cls._tz_offset())\r\n ).replace(tzinfo=None)\r\nE OverflowError: timestamp out of range for platform time_t\r\n\r\n.tox/py311/lib/python3.11/site-packages/freezegun/api.py:375: OverflowError\r\n\r\n---------- coverage: platform linux, python 3.11.7-final-0 -----------\r\nName Stmts Miss Cover\r\n----------------------------------------------------------------------------------\r\n.tox/py311/lib/python3.11/site-packages/humanize/__init__.py 8 0 100%\r\n.tox/py311/lib/python3.11/site-packages/humanize/filesize.py 24 0 100%\r\n.tox/py311/lib/python3.11/site-packages/humanize/i18n.py 56 4 93%\r\n.tox/py311/lib/python3.11/site-packages/humanize/number.py 165 7 96%\r\n.tox/py311/lib/python3.11/site-packages/humanize/time.py 224 0 100%\r\ntests/__init__.py 0 0 100%\r\ntests/test_filesize.py 10 0 100%\r\ntests/test_i18n.py 106 19 82%\r\ntests/test_number.py 32 0 100%\r\ntests/test_time.py 124 0 100%\r\n----------------------------------------------------------------------------------\r\nTOTAL 749 30 96%\r\nCoverage HTML written to dir htmlcov\r\nCoverage XML written to file coverage.xml\r\n\r\n======================================================= short test summary info =======================================================\r\nFAILED tests/test_time.py::test_naturaltime_timezone[test_input19-27 years from now] - OverflowError: timestamp out of range for platform time_t\r\nFAILED tests/test_time.py::test_naturaltime_timezone_when[test_input19-27 years from now] - OverflowError: timestamp out of range for platform time_t\r\n============================================== 2 failed, 547 passed, 23 skipped in 4.97s ==============================================\r\npy311: exit 1 (5.42 seconds) /home/mgorny/humanize\u003e .tox/py311/bin/python -m pytest --cov humanize --cov tests --cov-report html --cov-report term --cov-report xml pid=37634\r\n.pkg: _exit\u003e python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True hatchling.build\r\n py311: FAIL code 1 (21.29=setup[15.87]+cmd[5.42] seconds)\r\n evaluation failed :( (21.38 seconds)\r\n```\r\n\r\n### What versions are you using?\r\n\r\n* OS: Gentoo Linux x86\r\n* Python: 3.11.7\r\n* Humanize: 218a86ecf1e87802ec6ce31299c5933f0870c7d6","author":{"url":"https://github.com/mgorny","@type":"Person","name":"mgorny"},"datePublished":"2024-02-29T17:01:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/176/humanize/issues/176"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4667d2e2-bee1-261c-d67b-6a3f45570506 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E424:399A66:1B20B56:24C37C8:6A53F342 |
| html-safe-nonce | 9d5908a394cba220f2f7c60788df781a6b5347ad54e671c6f7c6ad6eff4291a5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDI0OjM5OUE2NjoxQjIwQjU2OjI0QzM3Qzg6NkE1M0YzNDIiLCJ2aXNpdG9yX2lkIjoiODM5Mzk1MTkzNzUzMjUyMzMzMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 09c2f3e484b5ed7dd77855b32a3dc9b204fa4d83723095de01d3e3b4564ac9e8 |
| hovercard-subject-tag | issue:2161713185 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-humanize/humanize/176/issue_layout |
| twitter:image | https://opengraph.githubassets.com/43d55b6a64973053f8cbc9ca07444c438f16f5208f2c4816129a111748a0e208/python-humanize/humanize/issues/176 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/43d55b6a64973053f8cbc9ca07444c438f16f5208f2c4816129a111748a0e208/python-humanize/humanize/issues/176 |
| og:image:alt | What did you do? tox -e py311 on a 32-bit x86 system. What did you expect to happen? Tests passing (possibly by skipping these tests on OverflowError). What actually happened? .pkg: install_require... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mgorny |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/python-humanize/humanize git https://github.com/python-humanize/humanize.git |
| octolytics-dimension-user_id | 62149795 |
| octolytics-dimension-user_login | python-humanize |
| octolytics-dimension-repository_id | 466683324 |
| octolytics-dimension-repository_nwo | python-humanize/humanize |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 466683324 |
| octolytics-dimension-repository_network_root_nwo | python-humanize/humanize |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width