arrow-py / arrow

🏹 Better dates & times for Python
https://arrow.readthedocs.io
Apache License 2.0
8.7k stars 673 forks source link

1.3.0: pytest fails in multiple units #1173

Open kloczek opened 4 months ago

kloczek commented 4 months ago

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

Here is pytest output: ```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-arrow-1.3.0-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-arrow-1.3.0-2.fc37.x86_64/usr/lib/python3.10/site-packages + /usr/bin/pytest -ra -m 'not network' -q -p no:randomly .......F...........................FF...................................FFFFFF....F.........FFF.........................................................................X.X.......... [ 9%] ..................................................s..............................................F................................................................................... [ 19%] ..................................................................................................................................................................................... [ 29%] ..................................................................................................................................................................................... [ 39%] ...........................................................................................................................................................FFFFFFFFFF................ [ 49%] ..................................................................................................................................................................................... [ 59%] ..................................................................................................................................................................................... [ 69%] ..................................................................................................................................................................................... [ 78%] ..................................................................................................................................................................................... [ 88%] ..................................................................................................................................................................................... [ 98%] ......................... [100%] ========================================================================================= FAILURES ========================================================================================== ___________________________________________________________________________ TestTestArrowInit.test_init_with_fold ___________________________________________________________________________ self = def test_init_with_fold(self): before = arrow.Arrow(2017, 10, 29, 2, 0, tzinfo="Europe/Stockholm") after = arrow.Arrow(2017, 10, 29, 2, 0, tzinfo="Europe/Stockholm", fold=1) assert hasattr(before, "fold") assert hasattr(after, "fold") # PEP-495 requires the comparisons below to be true assert before == after > assert before.utcoffset() != after.utcoffset() E assert datetime.timedelta(0) != datetime.timedelta(0) E + where datetime.timedelta(0) = >() E + where > = .utcoffset E + and datetime.timedelta(0) = >() E + where > = .utcoffset tests/test_arrow.py:79: AssertionError _________________________________________________________________________ TestArrowAttribute.test_getattr_ambiguous _________________________________________________________________________ self = def test_getattr_ambiguous(self): assert not self.now.ambiguous ambiguous_dt = arrow.Arrow(2017, 10, 29, 2, 0, tzinfo="Europe/Stockholm") > assert ambiguous_dt.ambiguous E assert False E + where False = .ambiguous tests/test_arrow.py:296: AssertionError _________________________________________________________________________ TestArrowAttribute.test_getattr_imaginary _________________________________________________________________________ self = def test_getattr_imaginary(self): assert not self.now.imaginary imaginary_dt = arrow.Arrow(2013, 3, 31, 2, 30, tzinfo="Europe/Paris") > assert imaginary_dt.imaginary E assert False E + where False = .imaginary tests/test_arrow.py:303: AssertionError ______________________________________________________________________ TestArrowConversion.test_to_amsterdam_then_utc _______________________________________________________________________ self = def test_to_amsterdam_then_utc(self): result = arrow.Arrow(2016, 10, 30).to("Europe/Amsterdam") > assert result.utcoffset() == timedelta(seconds=7200) E assert datetime.timedelta(0) == datetime.timedelta(seconds=7200) E + where datetime.timedelta(0) = >() E + where > = .utcoffset E + and datetime.timedelta(seconds=7200) = timedelta(seconds=7200) tests/test_arrow.py:567: AssertionError ______________________________________________________________________ TestArrowConversion.test_to_israel_same_offset _______________________________________________________________________ self = def test_to_israel_same_offset(self): result = arrow.Arrow(2019, 10, 27, 2, 21, 1, tzinfo="+03:00").to("Israel") expected = arrow.Arrow(2019, 10, 27, 1, 21, 1, tzinfo="Israel") > assert result == expected E assert == tests/test_arrow.py:574: AssertionError __________________________________________________________________________ TestArrowConversion.test_anchorage_dst ___________________________________________________________________________ self = def test_anchorage_dst(self): before = arrow.Arrow(2016, 3, 13, 1, 59, tzinfo="America/Anchorage") after = arrow.Arrow(2016, 3, 13, 2, 1, tzinfo="America/Anchorage") > assert before.utcoffset() != after.utcoffset() E assert datetime.timedelta(0) != datetime.timedelta(0) E + where datetime.timedelta(0) = >() E + where > = .utcoffset E + and datetime.timedelta(0) = >() E + where > = .utcoffset tests/test_arrow.py:582: AssertionError ___________________________________________________________________________ TestArrowConversion.test_chicago_fall ___________________________________________________________________________ self = def test_chicago_fall(self): result = arrow.Arrow(2017, 11, 5, 2, 1, tzinfo="-05:00").to("America/Chicago") expected = arrow.Arrow(2017, 11, 5, 1, 1, tzinfo="America/Chicago") > assert result == expected E assert == tests/test_arrow.py:589: AssertionError ___________________________________________________________________________ TestArrowConversion.test_toronto_gap ____________________________________________________________________________ self = def test_toronto_gap(self): before = arrow.Arrow(2011, 3, 13, 6, 30, tzinfo="UTC").to("America/Toronto") after = arrow.Arrow(2011, 3, 13, 7, 30, tzinfo="UTC").to("America/Toronto") > assert before.datetime.replace(tzinfo=None) == datetime(2011, 3, 13, 1, 30) E AssertionError: assert datetime.datetime(2011, 3, 13, 6, 30) == datetime.datetime(2011, 3, 13, 1, 30) E + where datetime.datetime(2011, 3, 13, 6, 30) = (tzinfo=None) E + where = datetime.datetime(2011, 3, 13, 6, 30, tzinfo=tzfile('/usr/share/zoneinfo/America/Toronto')).replace E + where datetime.datetime(2011, 3, 13, 6, 30, tzinfo=tzfile('/usr/share/zoneinfo/America/Toronto')) = .datetime E + and datetime.datetime(2011, 3, 13, 1, 30) = datetime(2011, 3, 13, 1, 30) tests/test_arrow.py:596: AssertionError ____________________________________________________________________________ TestArrowConversion.test_sydney_gap ____________________________________________________________________________ self = def test_sydney_gap(self): before = arrow.Arrow(2012, 10, 6, 15, 30, tzinfo="UTC").to("Australia/Sydney") after = arrow.Arrow(2012, 10, 6, 16, 30, tzinfo="UTC").to("Australia/Sydney") > assert before.datetime.replace(tzinfo=None) == datetime(2012, 10, 7, 1, 30) E AssertionError: assert datetime.datetime(2012, 10, 6, 15, 30) == datetime.datetime(2012, 10, 7, 1, 30) E + where datetime.datetime(2012, 10, 6, 15, 30) = (tzinfo=None) E + where = datetime.datetime(2012, 10, 6, 15, 30, tzinfo=tzfile('/usr/share/zoneinfo/Australia/Sydney')).replace E + where datetime.datetime(2012, 10, 6, 15, 30, tzinfo=tzfile('/usr/share/zoneinfo/Australia/Sydney')) = .datetime E + and datetime.datetime(2012, 10, 7, 1, 30) = datetime(2012, 10, 7, 1, 30) tests/test_arrow.py:605: AssertionError ____________________________________________________________________________ TestArrowReplace.test_replace_fold _____________________________________________________________________________ self = def test_replace_fold(self): before = arrow.Arrow(2017, 11, 5, 1, tzinfo="America/New_York") after = before.replace(fold=1) assert before.fold == 0 assert after.fold == 1 assert before == after > assert before.utcoffset() != after.utcoffset() E assert datetime.timedelta(0) != datetime.timedelta(0) E + where datetime.timedelta(0) = >() E + where > = .utcoffset E + and datetime.timedelta(0) = >() E + where > = .utcoffset tests/test_arrow.py:651: AssertionError _______________________________________________________________________ TestArrowShift.test_shift_positive_imaginary ________________________________________________________________________ self = def test_shift_positive_imaginary(self): # Avoid shifting into imaginary datetimes, take into account DST and other timezone changes. new_york = arrow.Arrow(2017, 3, 12, 1, 30, tzinfo="America/New_York") > assert new_york.shift(hours=+1) == arrow.Arrow( 2017, 3, 12, 3, 30, tzinfo="America/New_York" ) E AssertionError: assert == E + where = >(hours=+1) E + where > = .shift E + and = (2017, 3, 12, 3, 30, tzinfo='America/New_York') E + where = arrow.Arrow tests/test_arrow.py:801: AssertionError _______________________________________________________________________ TestArrowShift.test_shift_negative_imaginary ________________________________________________________________________ self = def test_shift_negative_imaginary(self): new_york = arrow.Arrow(2011, 3, 13, 3, 30, tzinfo="America/New_York") > assert new_york.shift(hours=-1) == arrow.Arrow( 2011, 3, 13, 3, 30, tzinfo="America/New_York" ) E AssertionError: assert == E + where = >(hours=-1) E + where > = .shift E + and = (2011, 3, 13, 3, 30, tzinfo='America/New_York') E + where = arrow.Arrow tests/test_arrow.py:829: AssertionError ___________________________________________________________________________ TestArrowShift.test_shift_kiritimati ____________________________________________________________________________ self = @pytest.mark.skipif( dateutil.__version__ < "2.7.1", reason="old tz database (2018d needed)" ) def test_shift_kiritimati(self): # corrected 2018d tz database release, will fail in earlier versions kiritimati = arrow.Arrow(1994, 12, 30, 12, 30, tzinfo="Pacific/Kiritimati") > assert kiritimati.shift(days=+1) == arrow.Arrow( 1995, 1, 1, 12, 30, tzinfo="Pacific/Kiritimati" ) E AssertionError: assert == E + where = >(days=+1) E + where > = .shift E + and = (1995, 1, 1, 12, 30, tzinfo='Pacific/Kiritimati') E + where = arrow.Arrow tests/test_arrow.py:857: AssertionError __________________________________________________________________________ TestFormatterFormatToken.test_timezone ___________________________________________________________________________ self = def test_timezone(self): dt = datetime.utcnow().replace(tzinfo=dateutil_tz.gettz("US/Pacific")) result = self.formatter._format_token(dt, "ZZ") > assert result == "-07:00" or result == "-08:00" E AssertionError: assert ('+00:00' == '-07:00' E E - -07:00 E + +00:00 or '+00:00' == '-08:00' E E - -08:00 E + +00:00) tests/test_formatter.py:119: AssertionError ___________________________________________________________________________ TestFormatterBuiltinFormats.test_atom ___________________________________________________________________________ self = def test_atom(self): > assert ( self.formatter.format(self.datetime, FORMAT_ATOM) == "1975-12-25 14:15:16-05:00" ) E AssertionError: assert '1975-12-25 14:15:16+00:00' == '1975-12-25 14:15:16-05:00' E E - 1975-12-25 14:15:16-05:00 E ? ^ ^ E + 1975-12-25 14:15:16+00:00 E ? ^ ^ tests/test_formatter.py:210: AssertionError __________________________________________________________________________ TestFormatterBuiltinFormats.test_cookie __________________________________________________________________________ self = def test_cookie(self): > assert ( self.formatter.format(self.datetime, FORMAT_COOKIE) == "Thursday, 25-Dec-1975 14:15:16 EST" ) E AssertionError: assert 'Thursday, 25...975 14:15:16 ' == 'Thursday, 25... 14:15:16 EST' E E - Thursday, 25-Dec-1975 14:15:16 EST E ? --- E + Thursday, 25-Dec-1975 14:15:16 tests/test_formatter.py:216: AssertionError _________________________________________________________________________ TestFormatterBuiltinFormats.test_rfc_822 __________________________________________________________________________ self = def test_rfc_822(self): > assert ( self.formatter.format(self.datetime, FORMAT_RFC822) == "Thu, 25 Dec 75 14:15:16 -0500" ) E AssertionError: assert 'Thu, 25 Dec ...4:15:16 +0000' == 'Thu, 25 Dec ...4:15:16 -0500' E E - Thu, 25 Dec 75 14:15:16 -0500 E ? ^^^ E + Thu, 25 Dec 75 14:15:16 +0000 E ? ^ ++ tests/test_formatter.py:222: AssertionError _________________________________________________________________________ TestFormatterBuiltinFormats.test_rfc_850 __________________________________________________________________________ self = def test_rfc_850(self): > assert ( self.formatter.format(self.datetime, FORMAT_RFC850) == "Thursday, 25-Dec-75 14:15:16 EST" ) E AssertionError: assert 'Thursday, 25...-75 14:15:16 ' == 'Thursday, 25... 14:15:16 EST' E E - Thursday, 25-Dec-75 14:15:16 EST E ? --- E + Thursday, 25-Dec-75 14:15:16 tests/test_formatter.py:228: AssertionError _________________________________________________________________________ TestFormatterBuiltinFormats.test_rfc_1036 _________________________________________________________________________ self = def test_rfc_1036(self): > assert ( self.formatter.format(self.datetime, FORMAT_RFC1036) == "Thu, 25 Dec 75 14:15:16 -0500" ) E AssertionError: assert 'Thu, 25 Dec ...4:15:16 +0000' == 'Thu, 25 Dec ...4:15:16 -0500' E E - Thu, 25 Dec 75 14:15:16 -0500 E ? ^^^ E + Thu, 25 Dec 75 14:15:16 +0000 E ? ^ ++ tests/test_formatter.py:234: AssertionError _________________________________________________________________________ TestFormatterBuiltinFormats.test_rfc_1123 _________________________________________________________________________ self = def test_rfc_1123(self): > assert ( self.formatter.format(self.datetime, FORMAT_RFC1123) == "Thu, 25 Dec 1975 14:15:16 -0500" ) E AssertionError: assert 'Thu, 25 Dec ...4:15:16 +0000' == 'Thu, 25 Dec ...4:15:16 -0500' E E - Thu, 25 Dec 1975 14:15:16 -0500 E ? ^^^ E + Thu, 25 Dec 1975 14:15:16 +0000 E ? ^ ++ tests/test_formatter.py:240: AssertionError _________________________________________________________________________ TestFormatterBuiltinFormats.test_rfc_2822 _________________________________________________________________________ self = def test_rfc_2822(self): > assert ( self.formatter.format(self.datetime, FORMAT_RFC2822) == "Thu, 25 Dec 1975 14:15:16 -0500" ) E AssertionError: assert 'Thu, 25 Dec ...4:15:16 +0000' == 'Thu, 25 Dec ...4:15:16 -0500' E E - Thu, 25 Dec 1975 14:15:16 -0500 E ? ^^^ E + Thu, 25 Dec 1975 14:15:16 +0000 E ? ^ ++ tests/test_formatter.py:246: AssertionError _________________________________________________________________________ TestFormatterBuiltinFormats.test_rfc3339 __________________________________________________________________________ self = def test_rfc3339(self): > assert ( self.formatter.format(self.datetime, FORMAT_RFC3339) == "1975-12-25 14:15:16-05:00" ) E AssertionError: assert '1975-12-25 14:15:16+00:00' == '1975-12-25 14:15:16-05:00' E E - 1975-12-25 14:15:16-05:00 E ? ^ ^ E + 1975-12-25 14:15:16+00:00 E ? ^ ^ tests/test_formatter.py:252: AssertionError ___________________________________________________________________________ TestFormatterBuiltinFormats.test_rss ____________________________________________________________________________ self = def test_rss(self): > assert ( self.formatter.format(self.datetime, FORMAT_RSS) == "Thu, 25 Dec 1975 14:15:16 -0500" ) E AssertionError: assert 'Thu, 25 Dec ...4:15:16 +0000' == 'Thu, 25 Dec ...4:15:16 -0500' E E - Thu, 25 Dec 1975 14:15:16 -0500 E ? ^^^ E + Thu, 25 Dec 1975 14:15:16 +0000 E ? ^ ++ tests/test_formatter.py:258: AssertionError ___________________________________________________________________________ TestFormatterBuiltinFormats.test_w3c ____________________________________________________________________________ self = def test_w3c(self): > assert ( self.formatter.format(self.datetime, FORMAT_W3C) == "1975-12-25 14:15:16-05:00" ) E AssertionError: assert '1975-12-25 14:15:16+00:00' == '1975-12-25 14:15:16-05:00' E E - 1975-12-25 14:15:16-05:00 E ? ^ ^ E + 1975-12-25 14:15:16+00:00 E ? ^ ^ tests/test_formatter.py:264: AssertionError ===================================================================================== warnings summary ====================================================================================== ../../../../../usr/lib/python3.10/site-packages/dateutil/zoneinfo/__init__.py:25 /usr/lib/python3.10/site-packages/dateutil/zoneinfo/__init__.py:25: UserWarning: I/O error(2): No such file or directory warnings.warn(f"I/O error({e.errno}): {e.strerror}") -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ========================================================================================== XPASSES ========================================================================================== ================================================================================== short test summary info ================================================================================== SKIPPED [1] tests/test_factory.py:117: could not import 'dateparser': No module named 'dateparser' XPASS tests/test_arrow.py::TestArrowHumanize::test_month - known issue with humanize month limits XPASS tests/test_arrow.py::TestArrowHumanize::test_months - known issue with humanize month limits FAILED tests/test_arrow.py::TestTestArrowInit::test_init_with_fold - assert datetime.timedelta(0) != datetime.timedelta(0) FAILED tests/test_arrow.py::TestArrowAttribute::test_getattr_ambiguous - assert False FAILED tests/test_arrow.py::TestArrowAttribute::test_getattr_imaginary - assert False FAILED tests/test_arrow.py::TestArrowConversion::test_to_amsterdam_then_utc - assert datetime.timedelta(0) == datetime.timedelta(seconds=7200) FAILED tests/test_arrow.py::TestArrowConversion::test_to_israel_same_offset - assert == FAILED tests/test_arrow.py::TestArrowConversion::test_anchorage_dst - assert datetime.timedelta(0) != datetime.timedelta(0) FAILED tests/test_arrow.py::TestArrowConversion::test_chicago_fall - assert == FAILED tests/test_arrow.py::TestArrowConversion::test_toronto_gap - AssertionError: assert datetime.datetime(2011, 3, 13, 6, 30) == datetime.datetime(2011, 3, 13, 1, 30) FAILED tests/test_arrow.py::TestArrowConversion::test_sydney_gap - AssertionError: assert datetime.datetime(2012, 10, 6, 15, 30) == datetime.datetime(2012, 10, 7, 1, 30) FAILED tests/test_arrow.py::TestArrowReplace::test_replace_fold - assert datetime.timedelta(0) != datetime.timedelta(0) FAILED tests/test_arrow.py::TestArrowShift::test_shift_positive_imaginary - AssertionError: assert == FAILED tests/test_arrow.py::TestArrowShift::test_shift_negative_imaginary - AssertionError: assert == FAILED tests/test_arrow.py::TestArrowShift::test_shift_kiritimati - AssertionError: assert == FAILED tests/test_formatter.py::TestFormatterFormatToken::test_timezone - AssertionError: assert ('+00:00' == '-07:00' FAILED tests/test_formatter.py::TestFormatterBuiltinFormats::test_atom - AssertionError: assert '1975-12-25 14:15:16+00:00' == '1975-12-25 14:15:16-05:00' FAILED tests/test_formatter.py::TestFormatterBuiltinFormats::test_cookie - AssertionError: assert 'Thursday, 25...975 14:15:16 ' == 'Thursday, 25... 14:15:16 EST' FAILED tests/test_formatter.py::TestFormatterBuiltinFormats::test_rfc_822 - AssertionError: assert 'Thu, 25 Dec ...4:15:16 +0000' == 'Thu, 25 Dec ...4:15:16 -0500' FAILED tests/test_formatter.py::TestFormatterBuiltinFormats::test_rfc_850 - AssertionError: assert 'Thursday, 25...-75 14:15:16 ' == 'Thursday, 25... 14:15:16 EST' FAILED tests/test_formatter.py::TestFormatterBuiltinFormats::test_rfc_1036 - AssertionError: assert 'Thu, 25 Dec ...4:15:16 +0000' == 'Thu, 25 Dec ...4:15:16 -0500' FAILED tests/test_formatter.py::TestFormatterBuiltinFormats::test_rfc_1123 - AssertionError: assert 'Thu, 25 Dec ...4:15:16 +0000' == 'Thu, 25 Dec ...4:15:16 -0500' FAILED tests/test_formatter.py::TestFormatterBuiltinFormats::test_rfc_2822 - AssertionError: assert 'Thu, 25 Dec ...4:15:16 +0000' == 'Thu, 25 Dec ...4:15:16 -0500' FAILED tests/test_formatter.py::TestFormatterBuiltinFormats::test_rfc3339 - AssertionError: assert '1975-12-25 14:15:16+00:00' == '1975-12-25 14:15:16-05:00' FAILED tests/test_formatter.py::TestFormatterBuiltinFormats::test_rss - AssertionError: assert 'Thu, 25 Dec ...4:15:16 +0000' == 'Thu, 25 Dec ...4:15:16 -0500' FAILED tests/test_formatter.py::TestFormatterBuiltinFormats::test_w3c - AssertionError: assert '1975-12-25 14:15:16+00:00' == '1975-12-25 14:15:16-05:00' 24 failed, 1808 passed, 1 skipped, 2 xpassed, 1 warning in 9.31s ```
List of installed modules in build env: ```console Package Version ----------------------------- ----------- alabaster 0.7.16 Babel 2.15.0 build 1.2.1 charset-normalizer 3.3.2 defusedxml 0.7.1 docutils 0.20.1 exceptiongroup 1.1.3 idna 3.7 imagesize 1.4.1 importlib_metadata 7.1.0 iniconfig 2.0.0 installer 0.7.0 Jinja2 3.1.4 MarkupSafe 2.1.5 packaging 24.0 pluggy 1.4.0 Pygments 2.18.0 pyproject_hooks 1.0.0 pytest 8.1.1 pytest-mock 3.14.0 python-dateutil 2.9.0.post0 pytz 2024.1 requests 2.31.0 simplejson 3.19.2 snowballstemmer 2.2.0 Sphinx 7.3.7 sphinx-autodoc-typehints 2.1.0 sphinx_rtd_theme 2.0.0 sphinxcontrib-applehelp 1.0.8 sphinxcontrib-devhelp 1.0.6 sphinxcontrib-htmlhelp 2.0.5 sphinxcontrib-jquery 4.1 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.7 sphinxcontrib-serializinghtml 1.1.10 tokenize_rt 5.2.0 tomli 2.0.1 urllib3 2.2.1 wheel 0.43.0 zipp 3.18.2 ```

Please let me know if you need more details or want me to perform some diagnostics.

System Info

krisfremen commented 3 months ago

@kloczek I'm not able to reproduce, would you be able to repro this in a container or something more isolated?

kloczek commented 3 months ago

I'm running all my builds in LXC zones so it is like on full system in which are installed ONLY build dependencies.

Did you had a time look on list of installed modules with versions and compare that with what I've provided? 🤔