Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test regressions on Python 3.13.0b1 #547

Closed
mgorny opened this issue May 8, 2024 · 2 comments
Closed

Test regressions on Python 3.13.0b1 #547

mgorny opened this issue May 8, 2024 · 2 comments

Comments

@mgorny
Copy link

mgorny commented May 8, 2024

Doesn't look like a major problem, though:

py313: install_deps> python -I -m pip install -r requirements.txt
py313: install_package_deps> python -I -m pip install 'python-dateutil>=2.7'
py313: install_package> python -I -m pip install --force-reinstall --no-deps /tmp/freezegun/.tox/.tmp/package/2/freezegun-1.5.0.tar.gz
py313: commands[0]> pytest --cov
========================================================= test session starts =========================================================
platform linux -- Python 3.13.0b1, pytest-8.2.0, pluggy-1.5.0
cachedir: .tox/py313/.pytest_cache
rootdir: /tmp/freezegun
configfile: pyproject.toml
plugins: cov-5.0.0
collected 133 items                                                                                                                   

tests/test_asyncio.py .....                                                                                                     [  3%]
tests/test_class_import.py ..............                                                                                       [ 14%]
tests/test_configure.py .....                                                                                                   [ 18%]
tests/test_datetimes.py .................s.....s.....s.s................FFF....................s                                [ 72%]
tests/test_errors.py ..                                                                                                         [ 73%]
tests/test_import_alias.py ...                                                                                                  [ 75%]
tests/test_operations.py .........                                                                                              [ 82%]
tests/test_pickle.py ...                                                                                                        [ 84%]
tests/test_sqlite3.py ..                                                                                                        [ 86%]
tests/test_ticking.py .s..........                                                                                              [ 95%]
tests/test_utils.py ..                                                                                                          [ 96%]
tests/test_uuid.py ..                                                                                                           [ 98%]
tests/test_warnings.py ..                                                                                                       [100%]

============================================================== FAILURES ===============================================================
________________________ TestUnitTestMethodDecorator.test_method_decorator_works_on_unittest_kwarg_frozen_time ________________________

self = <tests.test_datetimes.TestUnitTestMethodDecorator testMethod=test_method_decorator_works_on_unittest_kwarg_frozen_time>
frozen_time = <freezegun.api.FrozenDateTimeFactory object at 0x7fe69bcb4ff0>

    @freeze_time('2013-04-09', as_kwarg='frozen_time')
    def test_method_decorator_works_on_unittest_kwarg_frozen_time(self, frozen_time: Any) -> None:
        self.assertEqual(datetime.date(2013, 4, 9), datetime.date.today())
>       self.assertEqual(datetime.date(2013, 4, 9), frozen_time.time_to_freeze.today())
E       AssertionError: FakeDate(2013, 4, 9) != datetime.datetime(2013, 4, 9, 2, 0)

tests/test_datetimes.py:525: AssertionError
___________________ TestUnitTestMethodDecorator.test_method_decorator_works_on_unittest_kwarg_frozen_time_with_func ___________________

self = <tests.test_datetimes.TestUnitTestMethodDecorator testMethod=test_method_decorator_works_on_unittest_kwarg_frozen_time_with_func>
frozen_time = <freezegun.api.FrozenDateTimeFactory object at 0x7fe69bcddc70>

    @freeze_time(lambda: datetime.date(year=2013, month=4, day=9), as_kwarg='frozen_time')
    def test_method_decorator_works_on_unittest_kwarg_frozen_time_with_func(self, frozen_time: Any) -> None:
        self.assertEqual(datetime.date(2013, 4, 9), datetime.date.today())
>       self.assertEqual(datetime.date(2013, 4, 9), frozen_time.time_to_freeze.today())
E       AssertionError: FakeDate(2013, 4, 9) != datetime.datetime(2013, 4, 9, 2, 0)

tests/test_datetimes.py:535: AssertionError
___________________________ TestUnitTestMethodDecorator.test_method_decorator_works_on_unittest_kwarg_hello ___________________________

self = <tests.test_datetimes.TestUnitTestMethodDecorator testMethod=test_method_decorator_works_on_unittest_kwarg_hello>
kwargs = {'hello': <freezegun.api.FrozenDateTimeFactory object at 0x7fe69bcddea0>}

    @freeze_time('2013-04-09', as_kwarg='hello')
    def test_method_decorator_works_on_unittest_kwarg_hello(self, **kwargs: Any) -> None:
        self.assertEqual(datetime.date(2013, 4, 9), datetime.date.today())
>       self.assertEqual(datetime.date(2013, 4, 9), kwargs.get('hello').time_to_freeze.today())  # type: ignore
E       AssertionError: FakeDate(2013, 4, 9) != datetime.datetime(2013, 4, 9, 2, 0)

tests/test_datetimes.py:530: AssertionError
========================================================== warnings summary ===========================================================
tests/test_datetimes.py::test_simple_api
  /tmp/freezegun/tests/test_datetimes.py:74: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    assert datetime.datetime.utcnow() != datetime.datetime(2012, 1, 14)

tests/test_datetimes.py::test_compare_datetime_and_time_with_timezone
  /tmp/freezegun/tests/test_datetimes.py:783: 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).
    assert now == datetime.datetime.utcfromtimestamp(time.time())

tests/test_datetimes.py::test_timestamp_with_tzoffset
  /tmp/freezegun/tests/test_datetimes.py:800: 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).
    assert utcnow == datetime.datetime.utcfromtimestamp(time.time())

tests/test_pickle.py::test_pickle
  /tmp/freezegun/tests/test_pickle.py:13: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    utc_now = datetime.datetime.utcnow()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

----------- coverage: platform linux, python 3.13.0-beta-1 -----------
Name                    Stmts   Miss  Cover
-------------------------------------------
freezegun/__init__.py       8      0   100%
freezegun/_async.py        12      1    92%
freezegun/api.py          618     64    90%
freezegun/config.py        17      1    94%
-------------------------------------------
TOTAL                     655     66    90%

======================================================= short test summary info =======================================================
FAILED tests/test_datetimes.py::TestUnitTestMethodDecorator::test_method_decorator_works_on_unittest_kwarg_frozen_time - AssertionError: FakeDate(2013, 4, 9) != datetime.datetime(2013, 4, 9, 2, 0)
FAILED tests/test_datetimes.py::TestUnitTestMethodDecorator::test_method_decorator_works_on_unittest_kwarg_frozen_time_with_func - AssertionError: FakeDate(2013, 4, 9) != datetime.datetime(2013, 4, 9, 2, 0)
FAILED tests/test_datetimes.py::TestUnitTestMethodDecorator::test_method_decorator_works_on_unittest_kwarg_hello - AssertionError: FakeDate(2013, 4, 9) != datetime.datetime(2013, 4, 9, 2, 0)
======================================== 3 failed, 124 passed, 6 skipped, 4 warnings in 3.58s =========================================
py313: exit 1 (3.87 seconds) /tmp/freezegun> pytest --cov pid=27764
  py312: OK (13.34=setup[10.85]+cmd[2.49] seconds)
  py313: FAIL code 1 (80.29=setup[76.42]+cmd[3.87] seconds)
  evaluation failed :( (93.79 seconds)
@bblommers
Copy link
Collaborator

Thanks for letting us know @mgorny - this is now fixed in #550.

Not sure why these tests are actually failing, I didn't see anything in the 3.13 changelog about changes to the datetime module. The PR just changes the assertions to use strftime to verify equality.

@mgorny
Copy link
Author

mgorny commented Jun 29, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants