Skip to content

Test failure with Python 3.12 #202

Open
@fabaff

Description

@fabaff

Describe the bug
Tests starting to fail with python 3.12. They are passing with Python 3.11.

============================= test session starts ==============================
platform linux -- Python 3.12.2, pytest-7.4.4, pluggy-1.4.0
rootdir: /build/source
plugins: mock-3.12.0, time_machine-2.13.0
collected 277 items                                                            

tests/test_maya.py ..FF................................................. [ 19%]
........................................................................ [ 45%]
................................................................         [ 68%]
tests/test_maya_interval.py ............................................ [ 84%]
............................................                             [100%]

=================================== FAILURES ===================================
____ test_parse_iso8601[20161001T1430.4+05:30-2016-10-01T09:00:00.400000Z] _____

text = '20161001T1430.4+05:30'
[...]
        # We couldn't parse the string
        # so we fallback on the dateutil parser
        # If not strict
        if options.get("strict", True):
            raise ParserError(f"Unable to parse string [{text}]")
    
        try:
            dt = parser.parse(
                text, dayfirst=options["day_first"], yearfirst=options["year_first"]
            )
        except ValueError:
>           raise ParserError(f"Invalid date string: {text}")
E           pendulum.parsing.exceptions.ParserError: Invalid date string: 2016T14

/nix/store/93iilxyrqxs4l1da1c595w8l8ga9g5s8-python3.12-pendulum-3.0.0/lib/python3.12/site-packages/pendulum/parsing/__init__.py:132: ParserError
=============================== warnings summary ===============================
tests/test_maya.py: 669 warnings
tests/test_maya_interval.py: 530 warnings
  /build/source/maya/core.py:250: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
    dt = Datetime.utcfromtimestamp(self._epoch)

tests/test_maya.py::test_issue_104
  /build/source/tests/test_maya.py:81: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
    t = Datetime.utcfromtimestamp(e)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_maya.py::test_parse_iso8601[20161001T1430.4+05:30-2016-10-01T09:00:00.400000Z] - pendulum.parsing.exceptions.ParserError: Invalid date string: 20161001T1430...
FAILED tests/test_maya.py::test_parse_iso8601[2016T14-2016-01-01T14:00:00Z] - pendulum.parsing.exceptions.ParserError: Invalid date string: 2016T14
================= 2 failed, 275 passed, 1200 warnings in 1.81s =================

Environment and Version

  • OS (incl. terminal and shell used): not relevant
  • Python Version: 3.12
  • maya Version: 0.6.1
  • Your timezone: not relevant

To Reproduce
Run tests

Expected behavior
Tests to pass with Python 3.12

Screenshots
If applicable, add screenshots to help explain your problem.

Relevant log files
If applicable, information from log files supporting your claim.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions