python-tomlkit-0.5.3-4 fails to build with python3.8 due to failing tests. I think it is because of some change in python3.8. Links: buildlog from copr: https://copr-be.cloud.fedoraproject.org/results/@python/python3.8/fedora-rawhide-x86_64/00902610-python-tomlkit/builder-live.log recent scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=34600235 pytest output: ============================= test session starts ============================== platform linux -- Python 3.8.0a3, pytest-4.4.1, py-1.8.0, pluggy-0.9.0 rootdir: /builddir/build/BUILD/tomlkit-0.5.3 collected 227 items tests/test_api.py .................................................... [ 22%] tests/test_build.py .. [ 23%] tests/test_items.py .............FF..... [ 32%] tests/test_parser.py . [ 33%] tests/test_toml_document.py ................. [ 40%] tests/test_toml_file.py . [ 40%] tests/test_toml_tests.py ............................................... [ 61%] ........................................................................ [ 93%] ....... [ 96%] tests/test_utils.py ....... [ 99%] tests/test_write.py . [100%] =================================== FAILURES =================================== _____________________ test_datetimes_behave_like_datetimes _____________________ def test_datetimes_behave_like_datetimes(): i = item(datetime(2018, 7, 22, 12, 34, 56)) assert i == datetime(2018, 7, 22, 12, 34, 56) assert i.as_string() == "2018-07-22T12:34:56" > i += timedelta(days=1) tests/test_items.py:275: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tomlkit/items.py:525: in __add__ result = super(DateTime, self).__add__(other) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cls = <class 'tomlkit.items.DateTime'>, value = 2018 _ = (7, 23, 12, 34, 56, 0, ...) def __new__(cls, value, *_): # type: (..., datetime, ...) -> datetime return datetime.__new__( cls, > value.year, value.month, value.day, value.hour, value.minute, value.second, value.microsecond, tzinfo=value.tzinfo, ) E AttributeError: 'int' object has no attribute 'year' tomlkit/items.py:498: AttributeError _________________________ test_dates_behave_like_dates _________________________ def test_dates_behave_like_dates(): i = item(date(2018, 7, 22)) assert i == date(2018, 7, 22) assert i.as_string() == "2018-07-22" > i += timedelta(days=1) tests/test_items.py:295: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tomlkit/items.py:584: in __add__ result = super(Date, self).__add__(other) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cls = <class 'tomlkit.items.Date'>, value = 2018, _ = (7, 23) def __new__(cls, value, *_): # type: (..., date, ...) -> date > return date.__new__(cls, value.year, value.month, value.day) E AttributeError: 'int' object has no attribute 'year' tomlkit/items.py:565: AttributeError =============================== warnings summary =============================== tests/test_write.py:8 /builddir/build/BUILD/tomlkit-0.5.3/tests/test_write.py:8: SyntaxWarning: invalid escape sequence \e d = {"foo": "\e\u25E6\r"} tests/test_write.py:14 /builddir/build/BUILD/tomlkit-0.5.3/tests/test_write.py:14: SyntaxWarning: invalid escape sequence \e assert loads(dumps(d))["foo"] == "\e\u25E6\r" -- Docs: https://docs.pytest.org/en/latest/warnings.html =============== 2 failed, 225 passed, 2 warnings in 2.28 seconds =============== error: Bad exit status from /var/tmp/rpm-tmp.DM3Urw (%check) Bad exit status from /var/tmp/rpm-tmp.DM3Urw (%check)
I've reported both issues (date(time) AttributeError failures, new invalid escape sequence "\e" SyntaxWarnings) upstream: AttributeError: https://github.com/sdispater/tomlkit/issues/51 SyntaxWarning: https://github.com/sdispater/tomlkit/issues/52 Hopefully the upstream developers can help fix this in time.
SyntaxWarning is a warning only and the test failure looks like broken tests. Worst case scenario: we ship with the test deselected.
The datetime failures were due to return type change in datetime classes that are subclasses. Relevant CPython PR https://github.com/python/cpython/pull/10902 . This seems to be an intentional backwards incompatible change as I can see from Whats new entry text and discussion. Arithmetic operations between subclasses of :class:`datetime.date` or :class:`datetime.datetime` and :class:`datetime.timedelta` objects now return an instance of the subclass, rather than the base class. This also affects the return type of operations whose implementation (directly or indirectly) uses :class:`datetime.timedelta` arithmetic, such as :meth:`datetime.datetime.astimezone`.