question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CI failing on humanize test

See original GitHub issue

Issue Description

Current CRON CI build on master is failing. The test case tests/test_arrow.py::TestArrowHumanize::test_day is failing on the current master between 7:00-7:59pm EST. The tests pass when run at 8pm EST.

  __________________________ TestArrowHumanize.test_day __________________________
  
  self = <tests.test_arrow.TestArrowHumanize object at 0x7f851fcb8128>
  
      def test_day(self):
      
          later = self.now.shift(days=1)
      
          assert self.now.humanize(later) == "a day ago"
          assert later.humanize(self.now) == "in a day"
      
          # regression test for issue #697
          less_than_48_hours = self.now.shift(
              days=1, hours=23, seconds=59, microseconds=999999
          )
          assert self.now.humanize(less_than_48_hours) == "a day ago"
          assert less_than_48_hours.humanize(self.now) == "in a day"
      
          less_than_48_hours_date = less_than_48_hours._datetime.date()
          with pytest.raises(TypeError):
              # humanize other argument does not take raw datetime.date objects
              self.now.humanize(less_than_48_hours_date)
      
          # convert from date to arrow object
          less_than_48_hours_date = arrow.Arrow.fromdate(less_than_48_hours_date)
  >       assert self.now.humanize(less_than_48_hours_date) == "a day ago"
  E       AssertionError: assert '23 hours ago' == 'a day ago'
  E         - a day ago
  E         + 23 hours ago
  
  tests/test_arrow.py:1851: AssertionError

This test case reproduces it locally:

import arrow

now = arrow.Arrow(2020, 12, 1, 0, 55, 46, 798518)
print("now:", now)

less_than_48_hours = now.shift(
    days=1, hours=23, seconds=59, microseconds=999999
)
print("less_than_48_hours:", less_than_48_hours)

less_than_48_hours_date = arrow.Arrow.fromdate(less_than_48_hours._datetime.date())
print("less_than_48_hours_date:", less_than_48_hours_date)

humanized = now.humanize(less_than_48_hours_date)
print("humanized:", humanized)

# Should be "a day ago"
assert humanized == "a day ago"

System Info

  • 🖥 OS name and version: macOS 11.0
  • 🐍 Python version: 3.9.0
  • 🏹 Arrow version: latest master

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jadchaarcommented, Dec 31, 2020
  ________________________ TestArrowHumanize.test_months _________________________
  
  self = <tests.test_arrow.TestArrowHumanize object at 0x0000000003d52790>
  
      def test_months(self):
      
          later = self.now.shift(months=2)
          earlier = self.now.shift(months=-2)
      
          assert earlier.humanize(self.now) == "2 months ago"
  >       assert later.humanize(self.now) == "in 2 months"
  E       AssertionError: assert 'in a month' == 'in 2 months'
  E         - in 2 months
  E         ?    ^      -
  E         + in a month
  E         ?    ^
  
  tests/test_arrow.py:2160: AssertionError

Hmm, I guess another test failing also for some weird times, coming from https://github.com/arrow-py/arrow/pull/907/checks?check_run_id=1628813383

Ugh good find. Might be related to https://github.com/arrow-py/arrow/issues/749

0reactions
systemcatchcommented, Jan 1, 2021

This was one of the problems I encountered in #868. Any value we pick for _SECS_PER_MONTH will result in something being wrong. To fix this properly the “month” duration has to be calculated at runtime imo.

The annoying thing is that this could break installation in some cases. I suggest we find a fix before 1.0.0 or mark the month test as xfail for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Log - HEAD - third_party/go-humanize - Git at Google
9f541cc Adds commas to number formatting in english.Plural. by Chris Conway · 4 years, 4 months ago main master v1.0.0 · 02af396 Added...
Read more >
humanize-duration - npm
Start using humanize-duration in your project by running `npm i humanize-duration`. There are 404 other projects in the npm registry using ...
Read more >
Humanizer by Humanizr
Humanizer. Humanizer meets all your .NET needs for manipulating and displaying strings, enums, dates, times, timespans, numbers and quantities.
Read more >
The Humanizing Voice: Speech Reveals, and Text Conceals ...
Humanizing Voice. 3 medium lacking voice (i.e., transcript). By comparing the audiovisual and audio conditions, we further tested.
Read more >
Humanized mouse models of clinical disease - PMC - NCBI
Unfortunately, mouse models of tuberculosis usually fail to form ... Humanized mice have been used to test and compare the function and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found