Skip to content

Test failures with Python 3.15.0a5: test_date_today + DeprecationWarnings #610

@hroncok

Description

@hroncok

Python Version

3.15.0a5

pytest Version

9.0.2

Package Version

3.2.0 from main

Description

Hello. Just a heads up that running tox -e py315 fails with Python 3.15.0a5.

There is 1 actual failure, and 3 other tests fail due to the same DeprecationWarning, possibly leaking from pytest, not sure.

This is the actual failure:

_______________________________ test_date_today ________________________________

    def test_date_today():
        with time_machine.travel(EPOCH):
            today = dt.date.today()
>           assert today.year == 1970
E           assert 2026 == 1970
E            +  where 2026 = datetime.date(2026, 2, 9).year

tests/test_time_machine.py:133: AssertionError

@befeleme says it looks like this change in Python could be the culprit: python/cpython@fc3e22a

Full log:

Details
py315: uv-sync> uv sync --locked --python-preference system --extra cli --no-default-groups --no-editable --reinstall-package time-machine --group test -p cpython3.15
py315: commands[0]> python -W error -W ignore:datetime.datetime.utcfromtimestamp:DeprecationWarning -W ignore:datetime.datetime.utcnow:DeprecationWarning -m coverage run -m pytest tests
============================= test session starts ==============================
platform linux -- Python 3.15.0a5, pytest-9.0.2, pluggy-1.6.0
cachedir: .tox/py315/.pytest_cache
Using --randomly-seed=4217544912
rootdir: .../time-machine
configfile: pyproject.toml
plugins: randomly-4.0.1, time-machine-3.2.0
collected 207 items

tests/test_time_machine.py .s...............FF.........................F [ 21%]
...F....F............................................................... [ 56%]
..........................................                               [ 76%]
tests/test_cli.py ................................................       [100%]

=================================== FAILURES ===================================
__________________________ test_async_context_manager __________________________

main = <coroutine object test_async_context_manager.<locals>.record_time at 0x7f84c48e45a0>

    def run(main, *, debug=None, loop_factory=None):
        """Execute the coroutine and return the result.
    
        This function runs the passed coroutine, taking care of
        managing the asyncio event loop, finalizing asynchronous
        generators and closing the default executor.
    
        This function cannot be called when another asyncio event loop is
        running in the same thread.
    
        If debug is True, the event loop will be run in debug mode.
        If loop_factory is passed, it is used for new event loop creation.
    
        This function always creates a new event loop and closes it at the end.
        It should be used as a main entry point for asyncio programs, and should
        ideally only be called once.
    
        The executor is given a timeout duration of 5 minutes to shutdown.
        If the executor hasn't finished within that duration, a warning is
        emitted and the executor is closed.
    
        Example:
    
            async def main():
                await asyncio.sleep(1)
                print('hello')
    
            asyncio.run(main())
        """
        if events._get_running_loop() is not None:
            # fail fast with short traceback
            raise RuntimeError(
                "asyncio.run() cannot be called from a running event loop")
    
        with Runner(debug=debug, loop_factory=loop_factory) as runner:
>           return runner.run(main)
                   ^^^^^^^^^^^^^^^^

/usr/lib64/python3.15/asyncio/runners.py:204: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.15/asyncio/runners.py:109: in run
    task = self._loop.create_task(coro, context=context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/asyncio/base_events.py:470: in create_task
    task = tasks.Task(coro, loop=self, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/traceback.py:268: in extract_stack
    stack = StackSummary.extract(walk_stack(f), limit=limit)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/traceback.py:467: in extract
    return klass._extract_from_extended_frame_gen(
/usr/lib64/python3.15/traceback.py:499: in _extract_from_extended_frame_gen
    linecache.lazycache(filename, f.f_globals)
/usr/lib64/python3.15/linecache.py:217: in lazycache
    lazy_entry = _make_lazycache_entry(filename, module_globals)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/linecache.py:238: in _make_lazycache_entry
    loader = _bless_my_loader(module_globals)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

module_globals = {'__builtins__': <module 'builtins' (built-in)>, '__doc__': 'The pytest entry point.', '__file__': '...hon3.15/site-packages/pytest/__main__.py', '__loader__': <coverage.execfile.DummyLoader object at 0x7f84c5721500>, ...}

    def _bless_my_loader(module_globals):
        # Similar to _bless_my_loader() in importlib._bootstrap_external,
        # but always emits warnings instead of errors.
        loader = module_globals.get('__loader__')
        if loader is None and '__spec__' not in module_globals:
            return None
        spec = module_globals.get('__spec__')
    
        # The __main__ module has __spec__ = None.
        if spec is None and module_globals.get('__name__') == '__main__':
            return loader
    
        spec_loader = getattr(spec, 'loader', None)
        if spec_loader is None:
            import warnings
            warnings.warn(
                'Module globals is missing a __spec__.loader',
                DeprecationWarning)
            return loader
    
        assert spec_loader is not None
        if loader is not None and loader != spec_loader:
            import warnings
>           warnings.warn(
                'Module globals; __loader__ != __spec__.loader',
                DeprecationWarning)
E           DeprecationWarning: Module globals; __loader__ != __spec__.loader

/usr/lib64/python3.15/linecache.py:273: DeprecationWarning

During handling of the above exception, another exception occurred:

    def test_async_context_manager():
        recorded_time = None
    
        async def record_time() -> None:
            nonlocal recorded_time
            async with time_machine.travel(EPOCH + 150.0):
                recorded_time = time.time()
    
>       asyncio.run(record_time())

tests/test_time_machine.py:651: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.15/asyncio/runners.py:203: in run
    with Runner(debug=debug, loop_factory=loop_factory) as runner:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/asyncio/runners.py:63: in __exit__
    self.close()
/usr/lib64/python3.15/asyncio/runners.py:72: in close
    loop.run_until_complete(loop.shutdown_asyncgens())
/usr/lib64/python3.15/asyncio/base_events.py:698: in run_until_complete
    future = tasks.ensure_future(future, loop=self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/asyncio/tasks.py:732: in ensure_future
    return loop.create_task(coro_or_future)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/asyncio/base_events.py:470: in create_task
    task = tasks.Task(coro, loop=self, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/traceback.py:268: in extract_stack
    stack = StackSummary.extract(walk_stack(f), limit=limit)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/traceback.py:467: in extract
    return klass._extract_from_extended_frame_gen(
/usr/lib64/python3.15/traceback.py:499: in _extract_from_extended_frame_gen
    linecache.lazycache(filename, f.f_globals)
/usr/lib64/python3.15/linecache.py:217: in lazycache
    lazy_entry = _make_lazycache_entry(filename, module_globals)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/linecache.py:238: in _make_lazycache_entry
    loader = _bless_my_loader(module_globals)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

module_globals = {'__builtins__': <module 'builtins' (built-in)>, '__doc__': 'The pytest entry point.', '__file__': '...hon3.15/site-packages/pytest/__main__.py', '__loader__': <coverage.execfile.DummyLoader object at 0x7f84c5721500>, ...}

    def _bless_my_loader(module_globals):
        # Similar to _bless_my_loader() in importlib._bootstrap_external,
        # but always emits warnings instead of errors.
        loader = module_globals.get('__loader__')
        if loader is None and '__spec__' not in module_globals:
            return None
        spec = module_globals.get('__spec__')
    
        # The __main__ module has __spec__ = None.
        if spec is None and module_globals.get('__name__') == '__main__':
            return loader
    
        spec_loader = getattr(spec, 'loader', None)
        if spec_loader is None:
            import warnings
            warnings.warn(
                'Module globals is missing a __spec__.loader',
                DeprecationWarning)
            return loader
    
        assert spec_loader is not None
        if loader is not None and loader != spec_loader:
            import warnings
>           warnings.warn(
                'Module globals; __loader__ != __spec__.loader',
                DeprecationWarning)
E           DeprecationWarning: Module globals; __loader__ != __spec__.loader

/usr/lib64/python3.15/linecache.py:273: DeprecationWarning
__________________ test_async_context_manager_stops_properly ___________________

main = <coroutine object test_async_context_manager_stops_properly.<locals>.record_times at 0x7f84c4ce39b0>

    def run(main, *, debug=None, loop_factory=None):
        """Execute the coroutine and return the result.
    
        This function runs the passed coroutine, taking care of
        managing the asyncio event loop, finalizing asynchronous
        generators and closing the default executor.
    
        This function cannot be called when another asyncio event loop is
        running in the same thread.
    
        If debug is True, the event loop will be run in debug mode.
        If loop_factory is passed, it is used for new event loop creation.
    
        This function always creates a new event loop and closes it at the end.
        It should be used as a main entry point for asyncio programs, and should
        ideally only be called once.
    
        The executor is given a timeout duration of 5 minutes to shutdown.
        If the executor hasn't finished within that duration, a warning is
        emitted and the executor is closed.
    
        Example:
    
            async def main():
                await asyncio.sleep(1)
                print('hello')
    
            asyncio.run(main())
        """
        if events._get_running_loop() is not None:
            # fail fast with short traceback
            raise RuntimeError(
                "asyncio.run() cannot be called from a running event loop")
    
        with Runner(debug=debug, loop_factory=loop_factory) as runner:
>           return runner.run(main)
                   ^^^^^^^^^^^^^^^^

/usr/lib64/python3.15/asyncio/runners.py:204: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.15/asyncio/runners.py:109: in run
    task = self._loop.create_task(coro, context=context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/asyncio/base_events.py:470: in create_task
    task = tasks.Task(coro, loop=self, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/traceback.py:268: in extract_stack
    stack = StackSummary.extract(walk_stack(f), limit=limit)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/traceback.py:467: in extract
    return klass._extract_from_extended_frame_gen(
/usr/lib64/python3.15/traceback.py:499: in _extract_from_extended_frame_gen
    linecache.lazycache(filename, f.f_globals)
/usr/lib64/python3.15/linecache.py:217: in lazycache
    lazy_entry = _make_lazycache_entry(filename, module_globals)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/linecache.py:238: in _make_lazycache_entry
    loader = _bless_my_loader(module_globals)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

module_globals = {'__builtins__': <module 'builtins' (built-in)>, '__doc__': 'The pytest entry point.', '__file__': '...hon3.15/site-packages/pytest/__main__.py', '__loader__': <coverage.execfile.DummyLoader object at 0x7f84c5721500>, ...}

    def _bless_my_loader(module_globals):
        # Similar to _bless_my_loader() in importlib._bootstrap_external,
        # but always emits warnings instead of errors.
        loader = module_globals.get('__loader__')
        if loader is None and '__spec__' not in module_globals:
            return None
        spec = module_globals.get('__spec__')
    
        # The __main__ module has __spec__ = None.
        if spec is None and module_globals.get('__name__') == '__main__':
            return loader
    
        spec_loader = getattr(spec, 'loader', None)
        if spec_loader is None:
            import warnings
            warnings.warn(
                'Module globals is missing a __spec__.loader',
                DeprecationWarning)
            return loader
    
        assert spec_loader is not None
        if loader is not None and loader != spec_loader:
            import warnings
>           warnings.warn(
                'Module globals; __loader__ != __spec__.loader',
                DeprecationWarning)
E           DeprecationWarning: Module globals; __loader__ != __spec__.loader

/usr/lib64/python3.15/linecache.py:273: DeprecationWarning

During handling of the above exception, another exception occurred:

    def test_async_context_manager_stops_properly():
        recorded_times = []
    
        async def record_times() -> None:
            recorded_times.append(time.time())
    
            async with time_machine.travel(EPOCH + 160.0):
                recorded_times.append(time.time())
    
            recorded_times.append(time.time())
    
>       asyncio.run(record_times())

tests/test_time_machine.py:667: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.15/asyncio/runners.py:203: in run
    with Runner(debug=debug, loop_factory=loop_factory) as runner:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/asyncio/runners.py:63: in __exit__
    self.close()
/usr/lib64/python3.15/asyncio/runners.py:72: in close
    loop.run_until_complete(loop.shutdown_asyncgens())
/usr/lib64/python3.15/asyncio/base_events.py:698: in run_until_complete
    future = tasks.ensure_future(future, loop=self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/asyncio/tasks.py:732: in ensure_future
    return loop.create_task(coro_or_future)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/asyncio/base_events.py:470: in create_task
    task = tasks.Task(coro, loop=self, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/traceback.py:268: in extract_stack
    stack = StackSummary.extract(walk_stack(f), limit=limit)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/traceback.py:467: in extract
    return klass._extract_from_extended_frame_gen(
/usr/lib64/python3.15/traceback.py:499: in _extract_from_extended_frame_gen
    linecache.lazycache(filename, f.f_globals)
/usr/lib64/python3.15/linecache.py:217: in lazycache
    lazy_entry = _make_lazycache_entry(filename, module_globals)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/linecache.py:238: in _make_lazycache_entry
    loader = _bless_my_loader(module_globals)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

module_globals = {'__builtins__': <module 'builtins' (built-in)>, '__doc__': 'The pytest entry point.', '__file__': '...hon3.15/site-packages/pytest/__main__.py', '__loader__': <coverage.execfile.DummyLoader object at 0x7f84c5721500>, ...}

    def _bless_my_loader(module_globals):
        # Similar to _bless_my_loader() in importlib._bootstrap_external,
        # but always emits warnings instead of errors.
        loader = module_globals.get('__loader__')
        if loader is None and '__spec__' not in module_globals:
            return None
        spec = module_globals.get('__spec__')
    
        # The __main__ module has __spec__ = None.
        if spec is None and module_globals.get('__name__') == '__main__':
            return loader
    
        spec_loader = getattr(spec, 'loader', None)
        if spec_loader is None:
            import warnings
            warnings.warn(
                'Module globals is missing a __spec__.loader',
                DeprecationWarning)
            return loader
    
        assert spec_loader is not None
        if loader is not None and loader != spec_loader:
            import warnings
>           warnings.warn(
                'Module globals; __loader__ != __spec__.loader',
                DeprecationWarning)
E           DeprecationWarning: Module globals; __loader__ != __spec__.loader

/usr/lib64/python3.15/linecache.py:273: DeprecationWarning
_______________________________ test_date_today ________________________________

    def test_date_today():
        with time_machine.travel(EPOCH):
            today = dt.date.today()
>           assert today.year == 1970
E           assert 2026 == 1970
E            +  where 2026 = datetime.date(2026, 2, 9).year

tests/test_time_machine.py:133: AssertionError
_____________________ test_async_context_manager_traveller _____________________

main = <coroutine object test_async_context_manager_traveller.<locals>.test_traveller at 0x7f84c4382f90>

    def run(main, *, debug=None, loop_factory=None):
        """Execute the coroutine and return the result.
    
        This function runs the passed coroutine, taking care of
        managing the asyncio event loop, finalizing asynchronous
        generators and closing the default executor.
    
        This function cannot be called when another asyncio event loop is
        running in the same thread.
    
        If debug is True, the event loop will be run in debug mode.
        If loop_factory is passed, it is used for new event loop creation.
    
        This function always creates a new event loop and closes it at the end.
        It should be used as a main entry point for asyncio programs, and should
        ideally only be called once.
    
        The executor is given a timeout duration of 5 minutes to shutdown.
        If the executor hasn't finished within that duration, a warning is
        emitted and the executor is closed.
    
        Example:
    
            async def main():
                await asyncio.sleep(1)
                print('hello')
    
            asyncio.run(main())
        """
        if events._get_running_loop() is not None:
            # fail fast with short traceback
            raise RuntimeError(
                "asyncio.run() cannot be called from a running event loop")
    
        with Runner(debug=debug, loop_factory=loop_factory) as runner:
>           return runner.run(main)
                   ^^^^^^^^^^^^^^^^

/usr/lib64/python3.15/asyncio/runners.py:204: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.15/asyncio/runners.py:109: in run
    task = self._loop.create_task(coro, context=context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/asyncio/base_events.py:470: in create_task
    task = tasks.Task(coro, loop=self, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/traceback.py:268: in extract_stack
    stack = StackSummary.extract(walk_stack(f), limit=limit)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/traceback.py:467: in extract
    return klass._extract_from_extended_frame_gen(
/usr/lib64/python3.15/traceback.py:499: in _extract_from_extended_frame_gen
    linecache.lazycache(filename, f.f_globals)
/usr/lib64/python3.15/linecache.py:217: in lazycache
    lazy_entry = _make_lazycache_entry(filename, module_globals)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/linecache.py:238: in _make_lazycache_entry
    loader = _bless_my_loader(module_globals)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

module_globals = {'__builtins__': <module 'builtins' (built-in)>, '__doc__': 'The pytest entry point.', '__file__': '...hon3.15/site-packages/pytest/__main__.py', '__loader__': <coverage.execfile.DummyLoader object at 0x7f84c5721500>, ...}

    def _bless_my_loader(module_globals):
        # Similar to _bless_my_loader() in importlib._bootstrap_external,
        # but always emits warnings instead of errors.
        loader = module_globals.get('__loader__')
        if loader is None and '__spec__' not in module_globals:
            return None
        spec = module_globals.get('__spec__')
    
        # The __main__ module has __spec__ = None.
        if spec is None and module_globals.get('__name__') == '__main__':
            return loader
    
        spec_loader = getattr(spec, 'loader', None)
        if spec_loader is None:
            import warnings
            warnings.warn(
                'Module globals is missing a __spec__.loader',
                DeprecationWarning)
            return loader
    
        assert spec_loader is not None
        if loader is not None and loader != spec_loader:
            import warnings
>           warnings.warn(
                'Module globals; __loader__ != __spec__.loader',
                DeprecationWarning)
E           DeprecationWarning: Module globals; __loader__ != __spec__.loader

/usr/lib64/python3.15/linecache.py:273: DeprecationWarning

During handling of the above exception, another exception occurred:

    def test_async_context_manager_traveller():
        recorded_time = None
        shifted_time = None
    
        async def test_traveller() -> None:
            nonlocal recorded_time, shifted_time
            async with time_machine.travel(EPOCH + 170.0, tick=False) as traveller:
                recorded_time = time.time()
                traveller.shift(10.0)
                shifted_time = time.time()
    
>       asyncio.run(test_traveller())

tests/test_time_machine.py:685: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.15/asyncio/runners.py:203: in run
    with Runner(debug=debug, loop_factory=loop_factory) as runner:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/asyncio/runners.py:63: in __exit__
    self.close()
/usr/lib64/python3.15/asyncio/runners.py:72: in close
    loop.run_until_complete(loop.shutdown_asyncgens())
/usr/lib64/python3.15/asyncio/base_events.py:698: in run_until_complete
    future = tasks.ensure_future(future, loop=self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/asyncio/tasks.py:732: in ensure_future
    return loop.create_task(coro_or_future)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/asyncio/base_events.py:470: in create_task
    task = tasks.Task(coro, loop=self, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/traceback.py:268: in extract_stack
    stack = StackSummary.extract(walk_stack(f), limit=limit)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/traceback.py:467: in extract
    return klass._extract_from_extended_frame_gen(
/usr/lib64/python3.15/traceback.py:499: in _extract_from_extended_frame_gen
    linecache.lazycache(filename, f.f_globals)
/usr/lib64/python3.15/linecache.py:217: in lazycache
    lazy_entry = _make_lazycache_entry(filename, module_globals)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/linecache.py:238: in _make_lazycache_entry
    loader = _bless_my_loader(module_globals)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

module_globals = {'__builtins__': <module 'builtins' (built-in)>, '__doc__': 'The pytest entry point.', '__file__': '...hon3.15/site-packages/pytest/__main__.py', '__loader__': <coverage.execfile.DummyLoader object at 0x7f84c5721500>, ...}

    def _bless_my_loader(module_globals):
        # Similar to _bless_my_loader() in importlib._bootstrap_external,
        # but always emits warnings instead of errors.
        loader = module_globals.get('__loader__')
        if loader is None and '__spec__' not in module_globals:
            return None
        spec = module_globals.get('__spec__')
    
        # The __main__ module has __spec__ = None.
        if spec is None and module_globals.get('__name__') == '__main__':
            return loader
    
        spec_loader = getattr(spec, 'loader', None)
        if spec_loader is None:
            import warnings
            warnings.warn(
                'Module globals is missing a __spec__.loader',
                DeprecationWarning)
            return loader
    
        assert spec_loader is not None
        if loader is not None and loader != spec_loader:
            import warnings
>           warnings.warn(
                'Module globals; __loader__ != __spec__.loader',
                DeprecationWarning)
E           DeprecationWarning: Module globals; __loader__ != __spec__.loader

/usr/lib64/python3.15/linecache.py:273: DeprecationWarning
___________________________ test_coroutine_decorator ___________________________

main = <coroutine object test_coroutine_decorator.<locals>.record_time at 0x7f84c4383bf0>

    def run(main, *, debug=None, loop_factory=None):
        """Execute the coroutine and return the result.
    
        This function runs the passed coroutine, taking care of
        managing the asyncio event loop, finalizing asynchronous
        generators and closing the default executor.
    
        This function cannot be called when another asyncio event loop is
        running in the same thread.
    
        If debug is True, the event loop will be run in debug mode.
        If loop_factory is passed, it is used for new event loop creation.
    
        This function always creates a new event loop and closes it at the end.
        It should be used as a main entry point for asyncio programs, and should
        ideally only be called once.
    
        The executor is given a timeout duration of 5 minutes to shutdown.
        If the executor hasn't finished within that duration, a warning is
        emitted and the executor is closed.
    
        Example:
    
            async def main():
                await asyncio.sleep(1)
                print('hello')
    
            asyncio.run(main())
        """
        if events._get_running_loop() is not None:
            # fail fast with short traceback
            raise RuntimeError(
                "asyncio.run() cannot be called from a running event loop")
    
        with Runner(debug=debug, loop_factory=loop_factory) as runner:
>           return runner.run(main)
                   ^^^^^^^^^^^^^^^^

/usr/lib64/python3.15/asyncio/runners.py:204: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.15/asyncio/runners.py:109: in run
    task = self._loop.create_task(coro, context=context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/asyncio/base_events.py:470: in create_task
    task = tasks.Task(coro, loop=self, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/traceback.py:268: in extract_stack
    stack = StackSummary.extract(walk_stack(f), limit=limit)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/traceback.py:467: in extract
    return klass._extract_from_extended_frame_gen(
/usr/lib64/python3.15/traceback.py:499: in _extract_from_extended_frame_gen
    linecache.lazycache(filename, f.f_globals)
/usr/lib64/python3.15/linecache.py:217: in lazycache
    lazy_entry = _make_lazycache_entry(filename, module_globals)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/linecache.py:238: in _make_lazycache_entry
    loader = _bless_my_loader(module_globals)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

module_globals = {'__builtins__': <module 'builtins' (built-in)>, '__doc__': 'The pytest entry point.', '__file__': '...hon3.15/site-packages/pytest/__main__.py', '__loader__': <coverage.execfile.DummyLoader object at 0x7f84c5721500>, ...}

    def _bless_my_loader(module_globals):
        # Similar to _bless_my_loader() in importlib._bootstrap_external,
        # but always emits warnings instead of errors.
        loader = module_globals.get('__loader__')
        if loader is None and '__spec__' not in module_globals:
            return None
        spec = module_globals.get('__spec__')
    
        # The __main__ module has __spec__ = None.
        if spec is None and module_globals.get('__name__') == '__main__':
            return loader
    
        spec_loader = getattr(spec, 'loader', None)
        if spec_loader is None:
            import warnings
            warnings.warn(
                'Module globals is missing a __spec__.loader',
                DeprecationWarning)
            return loader
    
        assert spec_loader is not None
        if loader is not None and loader != spec_loader:
            import warnings
>           warnings.warn(
                'Module globals; __loader__ != __spec__.loader',
                DeprecationWarning)
E           DeprecationWarning: Module globals; __loader__ != __spec__.loader

/usr/lib64/python3.15/linecache.py:273: DeprecationWarning

During handling of the above exception, another exception occurred:

    def test_coroutine_decorator():
        recorded_time = None
    
        @time_machine.travel(EPOCH + 140.0)
        async def record_time() -> None:
            nonlocal recorded_time
            recorded_time = time.time()
    
>       asyncio.run(record_time())

tests/test_time_machine.py:638: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.15/asyncio/runners.py:203: in run
    with Runner(debug=debug, loop_factory=loop_factory) as runner:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/asyncio/runners.py:63: in __exit__
    self.close()
/usr/lib64/python3.15/asyncio/runners.py:72: in close
    loop.run_until_complete(loop.shutdown_asyncgens())
/usr/lib64/python3.15/asyncio/base_events.py:698: in run_until_complete
    future = tasks.ensure_future(future, loop=self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/asyncio/tasks.py:732: in ensure_future
    return loop.create_task(coro_or_future)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/asyncio/base_events.py:470: in create_task
    task = tasks.Task(coro, loop=self, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/traceback.py:268: in extract_stack
    stack = StackSummary.extract(walk_stack(f), limit=limit)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/traceback.py:467: in extract
    return klass._extract_from_extended_frame_gen(
/usr/lib64/python3.15/traceback.py:499: in _extract_from_extended_frame_gen
    linecache.lazycache(filename, f.f_globals)
/usr/lib64/python3.15/linecache.py:217: in lazycache
    lazy_entry = _make_lazycache_entry(filename, module_globals)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.15/linecache.py:238: in _make_lazycache_entry
    loader = _bless_my_loader(module_globals)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

module_globals = {'__builtins__': <module 'builtins' (built-in)>, '__doc__': 'The pytest entry point.', '__file__': '...hon3.15/site-packages/pytest/__main__.py', '__loader__': <coverage.execfile.DummyLoader object at 0x7f84c5721500>, ...}

    def _bless_my_loader(module_globals):
        # Similar to _bless_my_loader() in importlib._bootstrap_external,
        # but always emits warnings instead of errors.
        loader = module_globals.get('__loader__')
        if loader is None and '__spec__' not in module_globals:
            return None
        spec = module_globals.get('__spec__')
    
        # The __main__ module has __spec__ = None.
        if spec is None and module_globals.get('__name__') == '__main__':
            return loader
    
        spec_loader = getattr(spec, 'loader', None)
        if spec_loader is None:
            import warnings
            warnings.warn(
                'Module globals is missing a __spec__.loader',
                DeprecationWarning)
            return loader
    
        assert spec_loader is not None
        if loader is not None and loader != spec_loader:
            import warnings
>           warnings.warn(
                'Module globals; __loader__ != __spec__.loader',
                DeprecationWarning)
E           DeprecationWarning: Module globals; __loader__ != __spec__.loader

/usr/lib64/python3.15/linecache.py:273: DeprecationWarning
=========================== short test summary info ============================
FAILED tests/test_time_machine.py::test_async_context_manager - DeprecationWa...
FAILED tests/test_time_machine.py::test_async_context_manager_stops_properly
FAILED tests/test_time_machine.py::test_date_today - assert 2026 == 1970
FAILED tests/test_time_machine.py::test_async_context_manager_traveller - Dep...
FAILED tests/test_time_machine.py::test_coroutine_decorator - DeprecationWarn...
=================== 5 failed, 201 passed, 1 skipped in 1.49s ===================
py315: exit 1 (2.01 seconds) .../time-machine> python -W error -W ignore:datetime.datetime.utcfromtimestamp:DeprecationWarning -W ignore:datetime.datetime.utcnow:DeprecationWarning -m coverage run -m pytest tests pid=3690691
  py315: FAIL code 1 (2.65=setup[0.64]+cmd[2.01] seconds)
  evaluation failed :( (2.69 seconds)

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