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

Look into test warnings #982

Open
llucax opened this issue Jun 26, 2024 · 0 comments
Open

Look into test warnings #982

llucax opened this issue Jun 26, 2024 · 0 comments
Labels
part:tests Affects the unit, integration and performance (benchmarks) tests priority:❓ We need to figure out how soon this should be addressed type:bug Something isn't working
Milestone

Comments

@llucax
Copy link
Contributor

llucax commented Jun 26, 2024

What happened?

We have quite a few warnings when running the tests. Some seem to be indicating real bugs.

Warnings at the time of writing
$ nox -R -s pytest_max 
...
==================================================================================================================================================== warnings summary =====================================================================================================================================================
tests/actor/test_resampling.py::test_duplicate_request
tests/actor/test_resampling.py::test_duplicate_request
tests/actor/test_resampling.py::test_duplicate_request
tests/actor/test_resampling.py::test_duplicate_request
tests/actor/test_resampling.py::test_duplicate_request
  /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py:452: RuntimeWarning: coroutine '_Sender.send' was never awaited
    async with self._channel._recv_cv:
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
  /usr/lib/python3.11/inspect.py:3157: RuntimeWarning: coroutine 'LatestValueCache._run' was never awaited
    arg_val = kwargs.pop(param_name)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
  /home/luca/devel/sdk/src/frequenz/sdk/actor/_power_managing/_power_managing_actor.py:351: RuntimeWarning: coroutine '_Receiver.ready' was never awaited
    async for selected in select(
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
  /home/luca/devel/sdk/src/frequenz/sdk/actor/_power_managing/_power_managing_actor.py:351: RuntimeWarning: coroutine 'Timer.ready' was never awaited
    async for selected in select(
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
  /usr/lib/python3.11/unittest/mock.py:2515: RuntimeWarning: coroutine 'BatteryStatusTracker._run' was never awaited
    return tuple.__new__(cls, (name, args, kwargs))
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
  /usr/lib/python3.11/unittest/mock.py:2515: RuntimeWarning: coroutine 'LatestValueCache._run' was never awaited
    return tuple.__new__(cls, (name, args, kwargs))
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
  /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/unraisableexception.py:80: PytestUnraisableExceptionWarning: Exception ignored in: <coroutine object ComponentPoolStatusTracker._run at 0x7f6223d5e940>
  
  Traceback (most recent call last):
    File "/usr/lib/python3.11/unittest/mock.py", line 2515, in __new__
      return tuple.__new__(cls, (name, args, kwargs))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  RuntimeError: coroutine ignored GeneratorExit
  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

tests/timeseries/_formula_engine/test_formula_composition.py::TestFormulaComposition::test_formula_composition
tests/timeseries/_formula_engine/test_formula_composition.py::TestFormulaComposition::test_formula_composition_missing_bat
tests/timeseries/test_consumer.py::TestConsumer::test_consumer_power_no_grid_meter
  /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/unraisableexception.py:80: PytestUnraisableExceptionWarning: Exception ignored in: <function BackgroundService.__del__ at 0x7f624dbe59e0>
  
  Traceback (most recent call last):
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 235, in __del__
      self.cancel("{self!r} was deleted")
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 130, in cancel
      task.cancel(msg)
    File "/usr/lib/python3.11/asyncio/base_events.py", line 762, in call_soon
      self._check_closed()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 520, in _check_closed
      raise RuntimeError('Event loop is closed')
  RuntimeError: Event loop is closed
  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

tests/timeseries/test_frequency_streaming.py::test_grid_frequency_none
  /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/unraisableexception.py:80: PytestUnraisableExceptionWarning: Exception ignored in: <coroutine object ComponentPoolStatusTracker._run at 0x7f6222991440>
  
  Traceback (most recent call last):
    File "/usr/lib/python3.11/inspect.py", line 2119, in _signature_strip_non_python_syntax
      lines = [l.encode('ascii') for l in signature.split('\n') if l]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  RuntimeError: coroutine ignored GeneratorExit
  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

tests/timeseries/test_logical_meter.py::TestLogicalMeter::test_chp_power
  /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/unraisableexception.py:80: PytestUnraisableExceptionWarning: Exception ignored in: <coroutine object AsyncExitStack.__aexit__ at 0x7f6223779a80>
  
  Traceback (most recent call last):
    File "/home/luca/devel/sdk/tests/timeseries/mock_resampler.py", line 118, in multi_phase_senders
      Sample[Quantity], p3_name
      ~~~~~~^^^^^^^^^^
  RuntimeError: coroutine ignored GeneratorExit
  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

tests/timeseries/test_producer.py::TestProducer::test_producer_power
  /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/unraisableexception.py:80: PytestUnraisableExceptionWarning: Exception ignored in: <coroutine object ComponentPoolStatusTracker._run at 0x7f6223d5e840>
  
  Traceback (most recent call last):
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/_component_pool_status_tracker.py", line 115, in _run
      await self._update_status()
  GeneratorExit
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/usr/lib/python3.11/contextlib.py", line 728, in __aexit__
      cb_suppress = await cb(*exc_details)
                    ^^^^^^^^^^^^^^^^^^^^^^
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 185, in __aexit__
      await self.stop()
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 149, in stop
      await self.wait()
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 200, in wait
      done, pending = await asyncio.wait(self._tasks)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/asyncio/tasks.py", line 427, in wait
      loop = events.get_running_loop()
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  RuntimeError: no running event loop
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/_component_pool_status_tracker.py", line 110, in _run
      async with contextlib.AsyncExitStack() as stack:
    File "/usr/lib/python3.11/contextlib.py", line 745, in __aexit__
      raise exc_details[1]
    File "/usr/lib/python3.11/contextlib.py", line 728, in __aexit__
      cb_suppress = await cb(*exc_details)
                    ^^^^^^^^^^^^^^^^^^^^^^
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 185, in __aexit__
      await self.stop()
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 149, in stop
      await self.wait()
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 200, in wait
      done, pending = await asyncio.wait(self._tasks)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/asyncio/tasks.py", line 427, in wait
      loop = events.get_running_loop()
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  RuntimeError: no running event loop
  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

tests/timeseries/test_quantities.py::test_to_and_from_string[0-Power]
  /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/unraisableexception.py:80: PytestUnraisableExceptionWarning: Exception ignored in: <coroutine object AsyncExitStack.__aexit__ at 0x7f622377a840>
  
  Traceback (most recent call last):
    File "/usr/lib/python3.11/contextlib.py", line 745, in __aexit__
      raise exc_details[1]
    File "/usr/lib/python3.11/contextlib.py", line 728, in __aexit__
      cb_suppress = await cb(*exc_details)
                    ^^^^^^^^^^^^^^^^^^^^^^
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 185, in __aexit__
      await self.stop()
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 149, in stop
      await self.wait()
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 200, in wait
      done, pending = await asyncio.wait(self._tasks)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/asyncio/tasks.py", line 427, in wait
      loop = events.get_running_loop()
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  RuntimeError: no running event loop
  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

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

By enabling some Python debug features, more information can be obtained, but it is usually much much slower to run.

Example
$ PYTHONTRACEMALLOC=40 noxl -R -s pytest_max -- tests/timeseries/_formula_engine/test_formula_composition.py 
nox > Running session pytest_max
nox > pytest -W=all -vv tests/timeseries/_formula_engine/test_formula_composition.py
=================================================================================================================================================== test session starts ===================================================================================================================================================
platform linux -- Python 3.11.9, pytest-8.2.0, pluggy-1.5.0 -- /home/luca/devel/sdk/.direnv/python-3.11/bin/python3
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase(PosixPath('/home/luca/devel/sdk/.hypothesis/examples'))
rootdir: /home/luca/devel/sdk
configfile: pyproject.toml
plugins: anyio-4.4.0, asyncio-0.23.6, mock-3.14.0, time-machine-2.12.0, hypothesis-6.100.2
asyncio: mode=Mode.AUTO
collected 7 items                                                                                                                                                                                                                                                                                                         

tests/timeseries/_formula_engine/test_formula_composition.py::TestFormulaComposition::test_formula_composition PASSED                                                                                                                                                                                               [ 14%]
tests/timeseries/_formula_engine/test_formula_composition.py::TestFormulaComposition::test_formula_composition_missing_pv PASSED                                                                                                                                                                                    [ 28%]
tests/timeseries/_formula_engine/test_formula_composition.py::TestFormulaComposition::test_formula_composition_missing_bat PASSED                                                                                                                                                                                   [ 42%]
tests/timeseries/_formula_engine/test_formula_composition.py::TestFormulaComposition::test_formula_composition_min_max PASSED                                                                                                                                                                                       [ 57%]
tests/timeseries/_formula_engine/test_formula_composition.py::TestFormulaComposition::test_formula_composition_min_max_const PASSED                                                                                                                                                                                 [ 71%]
tests/timeseries/_formula_engine/test_formula_composition.py::TestFormulaComposition::test_formula_composition_constant PASSED                                                                                                                                                                                      [ 85%]
tests/timeseries/_formula_engine/test_formula_composition.py::TestFormulaComposition::test_3_phase_formulas PASSED                                                                                                                                                                                                  [100%]

==================================================================================================================================================== warnings summary =====================================================================================================================================================
tests/timeseries/_formula_engine/test_formula_composition.py::TestFormulaComposition::test_formula_composition_constant
  /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/unraisableexception.py:80: PytestUnraisableExceptionWarning: Exception ignored in: <coroutine object ComponentPoolStatusTracker._run at 0x7f6b17b4c740>
  
  Traceback (most recent call last):
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py", line 391, in __init__
      self._name: str = name if name is not None else f"{id(self):_}"
                                                      ^^^^^^^^^^^^^^^
  RuntimeError: coroutine ignored GeneratorExit
  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================================================================================================== 7 passed, 1 warning in 48.60s ==============================================================================================================================================
Task was destroyed but it is pending!
task: <Task pending name='#47' coro=<MetricFetcher.fetch_next() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py:393> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='#37' coro=<MetricFetcher.fetch_next() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py:393> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='#7' coro=<MetricFetcher.fetch_next() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py:393> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='#17' coro=<MetricFetcher.fetch_next() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py:393> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='#57' coro=<MetricFetcher.fetch_next() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py:393> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-13' coro=<Actor._run_loop() running at /home/luca/devel/sdk/src/frequenz/sdk/actor/_actor.py:91> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='LatestValueCache«PVManager«0x7f6b17b49150»:inverter«48»»' coro=<LatestValueCache._run() running at /home/luca/devel/sdk/src/frequenz/sdk/_internal/_channels.py:92> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='LatestValueCache«PVManager«0x7f6b17b49150»:inverter«58»»' coro=<LatestValueCache._run() running at /home/luca/devel/sdk/src/frequenz/sdk/_internal/_channels.py:92> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='8756121018577' coro=<_Receiver.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py:453> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[_wait.<locals>._on_completion() at /usr/lib/python3.11/asyncio/tasks.py:519]>
Task was destroyed but it is pending!
task: <Task pending name='8756121018557' coro=<_Receiver.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py:453> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[_wait.<locals>._on_completion() at /usr/lib/python3.11/asyncio/tasks.py:519]>
Task was destroyed but it is pending!
task: <Task pending name='8756121018613' coro=<_Receiver.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py:453> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[_wait.<locals>._on_completion() at /usr/lib/python3.11/asyncio/tasks.py:519]>
Task was destroyed but it is pending!
task: <Task pending name='8756126486997' coro=<_Receiver.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py:453> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[_wait.<locals>._on_completion() at /usr/lib/python3.11/asyncio/tasks.py:519]>
Task was destroyed but it is pending!
task: <Task pending name='8756116085697' coro=<_Receiver.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py:453> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[_wait.<locals>._on_completion() at /usr/lib/python3.11/asyncio/tasks.py:519]>
Task was destroyed but it is pending!
task: <Task pending name='0' coro=<Receiver.__anext__() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_receiver.py:159> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='1' coro=<Receiver.__anext__() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_receiver.py:159> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='#27' coro=<MetricFetcher.fetch_next() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py:393> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='#18' coro=<MetricFetcher.fetch_next() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py:393> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='#38' coro=<MetricFetcher.fetch_next() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py:393> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='#28' coro=<MetricFetcher.fetch_next() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py:393> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='#48' coro=<MetricFetcher.fetch_next() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py:393> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='#58' coro=<MetricFetcher.fetch_next() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py:393> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Actor PowerDistributingActor[140097935939856]: Raised a BaseException.
Traceback (most recent call last):
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_actor.py", line 91, in _run_loop
    await self._run()
GeneratorExit
Exception ignored in: <function BackgroundService.__del__ at 0x7f6b3b4e19e0>
Traceback (most recent call last):
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 235, in __del__
    self.cancel("{self!r} was deleted")
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 130, in cancel
    task.cancel(msg)
  File "/usr/lib/python3.11/asyncio/base_events.py", line 762, in call_soon
    self._check_closed()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 520, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending name='Task-12' coro=<ComponentPoolStatusTracker._run() running at /home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/_component_pool_status_tracker.py:115> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Exception ignored in: <function BackgroundService.__del__ at 0x7f6b3b4e19e0>
Traceback (most recent call last):
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 235, in __del__
    self.cancel("{self!r} was deleted")
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 130, in cancel
    task.cancel(msg)
  File "/usr/lib/python3.11/asyncio/base_events.py", line 762, in call_soon
    self._check_closed()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 520, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function BackgroundService.__del__ at 0x7f6b3b4e19e0>
Traceback (most recent call last):
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 235, in __del__
    self.cancel("{self!r} was deleted")
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 130, in cancel
    task.cancel(msg)
  File "/usr/lib/python3.11/asyncio/base_events.py", line 762, in call_soon
    self._check_closed()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 520, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <coroutine object ComponentPoolStatusTracker._run at 0x7f6b17b4de40>
Traceback (most recent call last):
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/_component_pool_status_tracker.py", line 110, in _run
    async with contextlib.AsyncExitStack() as stack:
  File "/usr/lib/python3.11/contextlib.py", line 745, in __aexit__
    raise exc_details[1]
  File "/usr/lib/python3.11/contextlib.py", line 728, in __aexit__
    cb_suppress = await cb(*exc_details)
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 185, in __aexit__
    await self.stop()
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 149, in stop
    await self.wait()
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 200, in wait
    done, pending = await asyncio.wait(self._tasks)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/tasks.py", line 427, in wait
    loop = events.get_running_loop()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: no running event loop
Task was destroyed but it is pending!
task: <Task pending name='Task-14' coro=<Actor._run_loop() running at /home/luca/devel/sdk/src/frequenz/sdk/actor/_actor.py:91> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-33' coro=<PVInverterStatusTracker._run_forever() running at /home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/_component_status/_pv_inverter_status_tracker.py:93> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-34' coro=<PVInverterStatusTracker._run_forever() running at /home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/_component_status/_pv_inverter_status_tracker.py:93> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task pending name='1' coro=<Receiver.__anext__() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_receiver.py:159> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='0' coro=<Receiver.__anext__() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_receiver.py:159> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Actor PowerManagingActor[140097936297744]: Raised a BaseException.
Traceback (most recent call last):
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_actor.py", line 91, in _run_loop
    await self._run()
GeneratorExit
Exception ignored in: <function BackgroundService.__del__ at 0x7f6b3b4e19e0>
Traceback (most recent call last):
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 235, in __del__
    self.cancel("{self!r} was deleted")
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 130, in cancel
    task.cancel(msg)
  File "/usr/lib/python3.11/asyncio/base_events.py", line 762, in call_soon
    self._check_closed()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 520, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending name='8756121018417' coro=<_Receiver.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py:453> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='8756121018505' coro=<_Receiver.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py:453> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='8756126487309' coro=<Timer.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/timer.py:667> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='8756116084969' coro=<Timer.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/timer.py:667> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='8756116084925' coro=<Timer.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/timer.py:667> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Exception ignored in: <coroutine object AsyncExitStack.__aexit__ at 0x7f6b1cfbafc0>
Traceback (most recent call last):
  File "/usr/lib/python3.11/contextlib.py", line 745, in __aexit__
    raise exc_details[1]
  File "/usr/lib/python3.11/contextlib.py", line 728, in __aexit__
    cb_suppress = await cb(*exc_details)
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 185, in __aexit__
    await self.stop()
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 149, in stop
    await self.wait()
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 200, in wait
    done, pending = await asyncio.wait(self._tasks)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/tasks.py", line 427, in wait
    loop = events.get_running_loop()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: no running event loop
Task was destroyed but it is pending!
task: <Task pending name='#4' coro=<MetricFetcher.fetch_next() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py:393> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='grid-power' coro=<MetricFetcher.fetch_next() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py:393> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='grid-power' coro=<MetricFetcher.fetch_next() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py:393> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='grid-power' coro=<MetricFetcher.fetch_next() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py:393> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='grid-power' coro=<MetricFetcher.fetch_next() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py:393> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='grid-power' coro=<MetricFetcher.fetch_next() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_steps.py:393> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[_wait.<locals>._on_completion() at /usr/lib/python3.11/asyncio/tasks.py:519]>
Task was destroyed but it is pending!
task: <Task pending name='Task-412' coro=<FormulaEngine._run() running at /home/luca/devel/sdk/src/frequenz/sdk/timeseries/formula_engine/_formula_engine.py:379> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Exception ignored in: <function BackgroundService.__del__ at 0x7f6b3b4e19e0>
Traceback (most recent call last):
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 235, in __del__
    self.cancel("{self!r} was deleted")
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 130, in cancel
    task.cancel(msg)
  File "/usr/lib/python3.11/asyncio/base_events.py", line 762, in call_soon
    self._check_closed()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 520, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function BackgroundService.__del__ at 0x7f6b3b4e19e0>
Traceback (most recent call last):
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 235, in __del__
    self.cancel("{self!r} was deleted")
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 130, in cancel
    task.cancel(msg)
  File "/usr/lib/python3.11/asyncio/base_events.py", line 762, in call_soon
    self._check_closed()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 520, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending name='Task-422' coro=<ComponentPoolStatusTracker._run() running at /home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/_component_pool_status_tracker.py:115> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-423' coro=<Actor._run_loop() running at /home/luca/devel/sdk/src/frequenz/sdk/actor/_actor.py:91> wait_for=<Future cancelled>>
Exception ignored in: <function BackgroundService.__del__ at 0x7f6b3b4e19e0>
Traceback (most recent call last):
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 235, in __del__
    self.cancel("{self!r} was deleted")
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 130, in cancel
    task.cancel(msg)
  File "/usr/lib/python3.11/asyncio/base_events.py", line 762, in call_soon
    self._check_closed()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 520, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task cancelling name='Task-424' coro=<Actor._run_loop() running at /home/luca/devel/sdk/src/frequenz/sdk/actor/_actor.py:91> wait_for=<Future cancelled>>
Exception ignored in: <coroutine object ComponentPoolStatusTracker._run at 0x7f6b17b4ce40>
Traceback (most recent call last):
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/_component_pool_status_tracker.py", line 110, in _run
    async with contextlib.AsyncExitStack() as stack:
  File "/usr/lib/python3.11/contextlib.py", line 745, in __aexit__
    raise exc_details[1]
  File "/usr/lib/python3.11/contextlib.py", line 728, in __aexit__
    cb_suppress = await cb(*exc_details)
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 185, in __aexit__
    await self.stop()
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 149, in stop
    await self.wait()
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 200, in wait
    done, pending = await asyncio.wait(self._tasks)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/tasks.py", line 427, in wait
    loop = events.get_running_loop()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: no running event loop
Actor PowerDistributingActor[140097935796560]: Raised a BaseException.
Traceback (most recent call last):
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_actor.py", line 91, in _run_loop
    await self._run()
GeneratorExit
Actor PowerManagingActor[140097935797200]: Raised a BaseException.
Traceback (most recent call last):
  File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_actor.py", line 91, in _run_loop
    await self._run()
GeneratorExit
Task was destroyed but it is pending!
task: <Task cancelling name='Task-435' coro=<EVChargerStatusTracker._run_forever() running at /home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/_component_status/_ev_charger_status_tracker.py:107> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task pending name='Task-436' coro=<EVChargerManager._run_forever() running at /home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/_component_managers/_ev_charger_manager/_ev_charger_manager.py:217> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='8756120987169' coro=<_Receiver.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py:453> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='8756120987625' coro=<_Receiver.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py:453> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='8756120987361' coro=<_Receiver.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py:453> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='8756126506645' coro=<Timer.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/timer.py:667> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='8756126506873' coro=<_Receiver.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py:453> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='8756120987569' coro=<_Receiver.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py:453> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='8756126506185' coro=<Timer.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/timer.py:667> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='0' coro=<Receiver.__anext__() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_receiver.py:159> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[_wait.<locals>._on_completion() at /usr/lib/python3.11/asyncio/tasks.py:519]>
Task was destroyed but it is pending!
task: <Task pending name='8756126506561' coro=<Merger.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_merge.py:160> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='8756126506317' coro=<_Receiver.ready() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py:453> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='0' coro=<Receiver.__anext__() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_receiver.py:159> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='0' coro=<Receiver.__anext__() running at /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_receiver.py:159> wait_for=<Future pending cb=[Task.task_wakeup()]>>
An incomplete run of all the tests with `PYTHONMALLOC=debug PYTHONTRACEMALLOC=30`
$ PYTHONMALLOC=debug PYTHONTRACEMALLOC=30 pytes
...
==================================================================================================================================================== warnings summary =====================================================================================================================================================
tests/actor/test_resampling.py::test_duplicate_request
  /usr/lib/python3.11/asyncio/base_events.py:437: RuntimeWarning: coroutine '_Sender.send' was never awaited
    task = tasks.Task(coro, loop=self, name=name, context=context)
  
  Object allocated at:
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/main.py", line 285
      session.exitstatus = doit(config, session) or 0
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/main.py", line 339
      config.hook.pytest_runtestloop(session=session)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/main.py", line 364
      item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 116
      runtestprotocol(item, nextitem=nextitem)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 135
      reports.append(call_and_report(item, "call", log))
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 240
      call = CallInfo.from_call(
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 341
      result: Optional[TResult] = func()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 241
      lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 173
      item.runtest()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 436
      super().runtest()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/python.py", line 1627
      self.ihook.pytest_pyfunc_call(pyfuncitem=self)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/python.py", line 162
      result = testfunction(**testargs)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 897
      _loop.run_until_complete(task)
    File "/usr/lib/python3.11/asyncio/base_events.py", line 641
      self.run_forever()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 608
      self._run_once()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 1936
      handle._run()
    File "/usr/lib/python3.11/asyncio/events.py", line 84
      self._context.run(self._callback, *self._args)
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_data_sourcing/microgrid_api_source.py", line 406
      awaitables.append(sender.send(sample))

tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
  /usr/lib/python3.11/inspect.py:2481: RuntimeWarning: coroutine 'LatestValueCache._run' was never awaited
    sig = obj.__signature__
  
  Object allocated at:
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/main.py", line 364
      item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 116
      runtestprotocol(item, nextitem=nextitem)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 135
      reports.append(call_and_report(item, "call", log))
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 240
      call = CallInfo.from_call(
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 341
      result: Optional[TResult] = func()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 241
      lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 173
      item.runtest()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 436
      super().runtest()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/python.py", line 1627
      self.ihook.pytest_pyfunc_call(pyfuncitem=self)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/python.py", line 162
      result = testfunction(**testargs)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 897
      _loop.run_until_complete(task)
    File "/usr/lib/python3.11/asyncio/base_events.py", line 641
      self.run_forever()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 608
      self._run_once()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 1936
      handle._run()
    File "/usr/lib/python3.11/asyncio/events.py", line 84
      self._context.run(self._callback, *self._args)
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_actor.py", line 91
      await self._run()
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/power_distributing.py", line 127
      await self._component_manager.start()
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/_component_managers/_battery_manager.py", line 191
      await self._create_channels()
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/_component_managers/_battery_manager.py", line 328
      self._inverter_caches[inverter_id] = LatestValueCache(
    File "/home/luca/devel/sdk/src/frequenz/sdk/_internal/_channels.py", line 58
      self._run(), name=f"LatestValueCache«{self._unique_id}»"

tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
  /home/luca/devel/sdk/src/frequenz/sdk/actor/_power_managing/_power_managing_actor.py:351: RuntimeWarning: coroutine 'Timer.ready' was never awaited
    async for selected in select(
  
  Object allocated at:
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 159
      item.session._setupstate.setup(item)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 512
      col.setup()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/python.py", line 1630
      self._request._fillfixtures()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/fixtures.py", line 683
      item.funcargs[argname] = self.getfixturevalue(argname)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/fixtures.py", line 518
      fixturedef = self._get_active_fixturedef(argname)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/fixtures.py", line 603
      fixturedef.execute(request=subrequest)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/fixtures.py", line 1073
      result = ihook.pytest_fixture_setup(fixturedef=self, request=request)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/fixtures.py", line 1122
      result = call_fixture_func(fixturefunc, request, kwargs)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/fixtures.py", line 884
      fixture_result = fixturefunc(**kwargs)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 344
      result = event_loop.run_until_complete(setup())
    File "/usr/lib/python3.11/asyncio/base_events.py", line 641
      self.run_forever()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 608
      self._run_once()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 1936
      handle._run()
    File "/usr/lib/python3.11/asyncio/events.py", line 84
      self._context.run(self._callback, *self._args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 326
      res = await gen_obj.__anext__()
    File "/home/luca/devel/sdk/tests/timeseries/_battery_pool/test_battery_pool_control_methods.py", line 53
      await mockgrid.start(mocker)
    File "/home/luca/devel/sdk/tests/timeseries/mock_microgrid.py", line 196
      self.mock_resampler = MockResampler(
    File "/home/luca/devel/sdk/tests/timeseries/mock_resampler.py", line 180
      self._meter_voltage_senders = voltage_senders(meter_ids)
    File "/home/luca/devel/sdk/tests/timeseries/mock_resampler.py", line 153
      return multi_phase_senders(
    File "/home/luca/devel/sdk/tests/timeseries/mock_resampler.py", line 111
      self._channel_registry.get_or_create(
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_channel_registry.py", line 102
      message_type, Broadcast(name=f"{self._name}-{key}")
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py", line 205
      self._recv_cv: Condition = Condition()
    File "/usr/lib/python3.11/asyncio/locks.py", line 239
      self._waiters = collections.deque()
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_power_managing/_power_managing_actor.py", line 351
      async for selected in select(

tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
  /home/luca/devel/sdk/src/frequenz/sdk/actor/_power_managing/_power_managing_actor.py:351: RuntimeWarning: coroutine '_Receiver.ready' was never awaited
    async for selected in select(
  
  Object allocated at:
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 159
      item.session._setupstate.setup(item)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 512
      col.setup()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/python.py", line 1630
      self._request._fillfixtures()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/fixtures.py", line 683
      item.funcargs[argname] = self.getfixturevalue(argname)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/fixtures.py", line 518
      fixturedef = self._get_active_fixturedef(argname)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/fixtures.py", line 603
      fixturedef.execute(request=subrequest)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/fixtures.py", line 1073
      result = ihook.pytest_fixture_setup(fixturedef=self, request=request)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/fixtures.py", line 1122
      result = call_fixture_func(fixturefunc, request, kwargs)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/fixtures.py", line 884
      fixture_result = fixturefunc(**kwargs)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 344
      result = event_loop.run_until_complete(setup())
    File "/usr/lib/python3.11/asyncio/base_events.py", line 641
      self.run_forever()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 608
      self._run_once()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 1936
      handle._run()
    File "/usr/lib/python3.11/asyncio/events.py", line 84
      self._context.run(self._callback, *self._args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 326
      res = await gen_obj.__anext__()
    File "/home/luca/devel/sdk/tests/timeseries/_battery_pool/test_battery_pool_control_methods.py", line 53
      await mockgrid.start(mocker)
    File "/home/luca/devel/sdk/tests/timeseries/mock_microgrid.py", line 196
      self.mock_resampler = MockResampler(
    File "/home/luca/devel/sdk/tests/timeseries/mock_resampler.py", line 180
      self._meter_voltage_senders = voltage_senders(meter_ids)
    File "/home/luca/devel/sdk/tests/timeseries/mock_resampler.py", line 153
      return multi_phase_senders(
    File "/home/luca/devel/sdk/tests/timeseries/mock_resampler.py", line 111
      self._channel_registry.get_or_create(
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_channel_registry.py", line 102
      message_type, Broadcast(name=f"{self._name}-{key}")
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py", line 205
      self._recv_cv: Condition = Condition()
    File "/usr/lib/python3.11/asyncio/locks.py", line 239
      self._waiters = collections.deque()
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_power_managing/_power_managing_actor.py", line 351
      async for selected in select(

tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
  /usr/lib/python3.11/asyncio/locks.py:239: RuntimeWarning: coroutine 'BatteryStatusTracker._run' was never awaited
    self._waiters = collections.deque()
  
  Object allocated at:
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/main.py", line 364
      item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 116
      runtestprotocol(item, nextitem=nextitem)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 135
      reports.append(call_and_report(item, "call", log))
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 240
      call = CallInfo.from_call(
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 341
      result: Optional[TResult] = func()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 241
      lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 173
      item.runtest()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 436
      super().runtest()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/python.py", line 1627
      self.ihook.pytest_pyfunc_call(pyfuncitem=self)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/python.py", line 162
      result = testfunction(**testargs)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 897
      _loop.run_until_complete(task)
    File "/usr/lib/python3.11/asyncio/base_events.py", line 641
      self.run_forever()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 608
      self._run_once()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 1936
      handle._run()
    File "/usr/lib/python3.11/asyncio/events.py", line 84
      self._context.run(self._callback, *self._args)
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/_component_pool_status_tracker.py", line 112
      await stack.enter_async_context(tracker)
    File "/usr/lib/python3.11/contextlib.py", line 650
      result = await _enter(cm)
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 167
      self.start()
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/_component_status/_battery_status_tracker.py", line 159
      self._run(self._status_sender, self._set_power_result_receiver)

tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
  /usr/lib/python3.11/asyncio/locks.py:239: RuntimeWarning: coroutine 'LatestValueCache._run' was never awaited
    self._waiters = collections.deque()
  
  Object allocated at:
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/main.py", line 364
      item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 116
      runtestprotocol(item, nextitem=nextitem)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 135
      reports.append(call_and_report(item, "call", log))
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 240
      call = CallInfo.from_call(
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 341
      result: Optional[TResult] = func()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 241
      lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 173
      item.runtest()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 436
      super().runtest()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/python.py", line 1627
      self.ihook.pytest_pyfunc_call(pyfuncitem=self)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/python.py", line 162
      result = testfunction(**testargs)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 897
      _loop.run_until_complete(task)
    File "/usr/lib/python3.11/asyncio/base_events.py", line 641
      self.run_forever()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 608
      self._run_once()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 1936
      handle._run()
    File "/usr/lib/python3.11/asyncio/events.py", line 84
      self._context.run(self._callback, *self._args)
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_actor.py", line 91
      await self._run()
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/power_distributing.py", line 127
      await self._component_manager.start()
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/_component_managers/_battery_manager.py", line 191
      await self._create_channels()
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/power_distributing/_component_managers/_battery_manager.py", line 328
      self._inverter_caches[inverter_id] = LatestValueCache(
    File "/home/luca/devel/sdk/src/frequenz/sdk/_internal/_channels.py", line 58
      self._run(), name=f"LatestValueCache«{self._unique_id}»"

tests/timeseries/_battery_pool/test_battery_pool_control_methods.py::TestBatteryPoolControl::test_case_1
  /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/unraisableexception.py:80: PytestUnraisableExceptionWarning: Exception ignored in: <coroutine object ComponentPoolStatusTracker._run at 0x7f2c5857fce0>
  
  Traceback (most recent call last):
    File "/usr/lib/python3.11/asyncio/locks.py", line 239, in __init__
      self._waiters = collections.deque()
                      ^^^^^^^^^^^^^^^^^^^
  RuntimeError: coroutine ignored GeneratorExit
  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

tests/timeseries/_formula_engine/test_formula_composition.py::TestFormulaComposition::test_formula_composition
  /home/luca/devel/sdk/src/frequenz/sdk/actor/_power_managing/_power_managing_actor.py:351: RuntimeWarning: coroutine '_Receiver.ready' was never awaited
    async for selected in select(
  
  Object allocated at:
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 173
      item.runtest()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 436
      super().runtest()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/python.py", line 1627
      self.ihook.pytest_pyfunc_call(pyfuncitem=self)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/python.py", line 162
      result = testfunction(**testargs)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 897
      _loop.run_until_complete(task)
    File "/usr/lib/python3.11/asyncio/base_events.py", line 641
      self.run_forever()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 608
      self._run_once()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 1936
      handle._run()
    File "/usr/lib/python3.11/asyncio/events.py", line 84
      self._context.run(self._callback, *self._args)
    File "/home/luca/devel/sdk/tests/timeseries/_formula_engine/test_formula_composition.py", line 34
      async with mockgrid, AsyncExitStack() as stack:
    File "/home/luca/devel/sdk/tests/timeseries/mock_microgrid.py", line 605
      await self.start()
    File "/home/luca/devel/sdk/tests/timeseries/mock_microgrid.py", line 195
      self.init_mock_client(lambda mock_client: mock_client.initialize(local_mocker))
    File "/home/luca/devel/sdk/tests/timeseries/mock_microgrid.py", line 211
      self.mock_client = MockMicrogridClient(self._components, self._connections)
    File "/home/luca/devel/sdk/tests/utils/mock_microgrid_client.py", line 71
      mock_api = self._create_mock_api(
    File "/home/luca/devel/sdk/tests/utils/mock_microgrid_client.py", line 265
      api.battery_data = AsyncMock(
    File "/usr/lib/python3.11/unittest/mock.py", line 2212
      code_mock = NonCallableMock(spec_set=CodeType)
    File "/usr/lib/python3.11/unittest/mock.py", line 457
      self._mock_add_spec(spec, spec_set, _spec_as_instance, _eat_self)
    File "/usr/lib/python3.11/unittest/mock.py", line 523
      res = _get_signature_object(spec,
    File "/usr/lib/python3.11/unittest/mock.py", line 119
      return func, inspect.signature(sig_func)
    File "/usr/lib/python3.11/inspect.py", line 3263
      return Signature.from_callable(obj, follow_wrapped=follow_wrapped,
    File "/usr/lib/python3.11/inspect.py", line 3011
      return _signature_from_callable(obj, sigcls=cls,
    File "/usr/lib/python3.11/inspect.py", line 2532
      wrapped_sig = _get_signature_of(obj.func)
    File "/usr/lib/python3.11/inspect.py", line 2528
      return _signature_from_builtin(sigcls, obj,
    File "/usr/lib/python3.11/inspect.py", line 2328
      return _signature_fromstr(cls, func, s, skip_bound_arg)
    File "/usr/lib/python3.11/inspect.py", line 2276
      p(name, default)
    File "/usr/lib/python3.11/inspect.py", line 2265
      parameters.append(Parameter(name, kind, default=default, annotation=empty))
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_power_managing/_power_managing_actor.py", line 351
      async for selected in select(

tests/timeseries/_formula_engine/test_formula_composition.py::TestFormulaComposition::test_formula_composition
  /home/luca/devel/sdk/src/frequenz/sdk/timeseries/ev_charger_pool/_system_bounds_tracker.py:130: RuntimeWarning: coroutine 'Merger.ready' was never awaited
    async for selected in select(status_rx, ev_data_rx):
  
  Object allocated at:
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/runner.py", line 173
      item.runtest()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 436
      super().runtest()
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/python.py", line 1627
      self.ihook.pytest_pyfunc_call(pyfuncitem=self)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_hooks.py", line 513
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_manager.py", line 120
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pluggy/_callers.py", line 103
      res = hook_impl.function(*args)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/python.py", line 162
      result = testfunction(**testargs)
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 897
      _loop.run_until_complete(task)
    File "/usr/lib/python3.11/asyncio/base_events.py", line 641
      self.run_forever()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 608
      self._run_once()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 1936
      handle._run()
    File "/usr/lib/python3.11/asyncio/events.py", line 84
      self._context.run(self._callback, *self._args)
    File "/home/luca/devel/sdk/tests/timeseries/_formula_engine/test_formula_composition.py", line 34
      async with mockgrid, AsyncExitStack() as stack:
    File "/home/luca/devel/sdk/tests/timeseries/mock_microgrid.py", line 605
      await self.start()
    File "/home/luca/devel/sdk/tests/timeseries/mock_microgrid.py", line 195
      self.init_mock_client(lambda mock_client: mock_client.initialize(local_mocker))
    File "/home/luca/devel/sdk/tests/timeseries/mock_microgrid.py", line 211
      self.mock_client = MockMicrogridClient(self._components, self._connections)
    File "/home/luca/devel/sdk/tests/utils/mock_microgrid_client.py", line 71
      mock_api = self._create_mock_api(
    File "/home/luca/devel/sdk/tests/utils/mock_microgrid_client.py", line 265
      api.battery_data = AsyncMock(
    File "/usr/lib/python3.11/unittest/mock.py", line 2212
      code_mock = NonCallableMock(spec_set=CodeType)
    File "/usr/lib/python3.11/unittest/mock.py", line 457
      self._mock_add_spec(spec, spec_set, _spec_as_instance, _eat_self)
    File "/usr/lib/python3.11/unittest/mock.py", line 523
      res = _get_signature_object(spec,
    File "/usr/lib/python3.11/unittest/mock.py", line 119
      return func, inspect.signature(sig_func)
    File "/usr/lib/python3.11/inspect.py", line 3263
      return Signature.from_callable(obj, follow_wrapped=follow_wrapped,
    File "/usr/lib/python3.11/inspect.py", line 3011
      return _signature_from_callable(obj, sigcls=cls,
    File "/usr/lib/python3.11/inspect.py", line 2532
      wrapped_sig = _get_signature_of(obj.func)
    File "/usr/lib/python3.11/inspect.py", line 2528
      return _signature_from_builtin(sigcls, obj,
    File "/usr/lib/python3.11/inspect.py", line 2328
      return _signature_fromstr(cls, func, s, skip_bound_arg)
    File "/usr/lib/python3.11/inspect.py", line 2276
      p(name, default)
    File "/usr/lib/python3.11/inspect.py", line 2265
      parameters.append(Parameter(name, kind, default=default, annotation=empty))
    File "/home/luca/devel/sdk/src/frequenz/sdk/timeseries/ev_charger_pool/_system_bounds_tracker.py", line 130
      async for selected in select(status_rx, ev_data_rx):

tests/timeseries/_formula_engine/test_formula_composition.py::TestFormulaComposition::test_formula_composition
tests/timeseries/_formula_engine/test_formula_composition.py::TestFormulaComposition::test_formula_composition_missing_bat
tests/timeseries/test_consumer.py::TestConsumer::test_consumer_power_no_grid_meter
  /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/unraisableexception.py:80: PytestUnraisableExceptionWarning: Exception ignored in: <function BackgroundService.__del__ at 0x7f2c846f8940>
  
  Traceback (most recent call last):
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 235, in __del__
      self.cancel("{self!r} was deleted")
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 130, in cancel
      task.cancel(msg)
    File "/usr/lib/python3.11/asyncio/base_events.py", line 762, in call_soon
      self._check_closed()
    File "/usr/lib/python3.11/asyncio/base_events.py", line 520, in _check_closed
      raise RuntimeError('Event loop is closed')
  RuntimeError: Event loop is closed
  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

tests/timeseries/test_periodic_feature_extractor.py::test_feature_extractor
  /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/unraisableexception.py:80: PytestUnraisableExceptionWarning: Exception ignored in: <coroutine object ComponentPoolStatusTracker._run at 0x7f2c59d1bf00>
  
  Traceback (most recent call last):
    File "/home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/frequenz/channels/_broadcast.py", line 344, in send
      for _hash, recv_ref in self._channel._receivers.items():
  RuntimeError: coroutine ignored GeneratorExit
  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

tests/timeseries/test_quantities.py::test_quantity_multiplied_with_float[from_kilohertz]
  /home/luca/devel/sdk/.direnv/python-3.11/lib/python3.11/site-packages/_pytest/unraisableexception.py:80: PytestUnraisableExceptionWarning: Exception ignored in: <coroutine object AsyncExitStack.__aexit__ at 0x7f2c5b4f9550>
  
  Traceback (most recent call last):
    File "/usr/lib/python3.11/contextlib.py", line 745, in __aexit__
      raise exc_details[1]
    File "/usr/lib/python3.11/contextlib.py", line 728, in __aexit__
      cb_suppress = await cb(*exc_details)
                    ^^^^^^^^^^^^^^^^^^^^^^
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 185, in __aexit__
      await self.stop()
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 149, in stop
      await self.wait()
    File "/home/luca/devel/sdk/src/frequenz/sdk/actor/_background_service.py", line 200, in wait
      done, pending = await asyncio.wait(self._tasks)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/asyncio/tasks.py", line 427, in wait
      loop = events.get_running_loop()
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  RuntimeError: no running event loop
  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

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

What did you expect instead?

No warnings.

Affected version(s)

v1.0.0rc700

Affected part(s)

Unit, integration and performance tests (part:tests)

Extra information

We could try to find out if there is a way to make warnings errors in tests, so we don't end up in this situation again where a lot of warnings accumulated and it is hard to remove them all at once.

@llucax llucax added priority:❓ We need to figure out how soon this should be addressed type:bug Something isn't working labels Jun 26, 2024
@keywordlabeler keywordlabeler bot added the part:tests Affects the unit, integration and performance (benchmarks) tests label Jun 26, 2024
@llucax llucax added this to the Untriaged milestone Jun 26, 2024
github-merge-queue bot pushed a commit that referenced this issue Jun 26, 2024
Because of some issues with asyncio and caplog, maybe pytest-asyncio,
that reports some pending tasks from an unrelated test, we need to
filter out the logs from the relevant loggers when checking for the
expected logs.

Related to #982.
github-merge-queue bot pushed a commit that referenced this issue Jun 26, 2024
The data sourcing actor is parallelizing the sending of samples to the
stream senders, but it was not properly keeping references to the tasks
and awaiting for them to finish.

References were probably kept by `gather()`, but `gather()` wasn't
awaited, so it can potentially not run at all (although it seems it did,
because things were working).

This commit uses a `TaskGroup` to keep references to the tasks in
`process_msg()` and then makes each `process_msg()` call a task too, but
we don't use a task group here because we don't want to await until a
batch of messages is sent before receiving the next one. Instead, we
want to keep sending messages in the background. But we still need to
clean up these tasks as soon as they are done.

This replaces the event used to wait until there are no more pending
messages to be sent, as it is enough to synchronize awaiting for the
(pending) tasks to finish.

This was discovered while looking at warnings in the tests (#982).
@llucax llucax modified the milestones: Untriaged, post-v1.0 Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part:tests Affects the unit, integration and performance (benchmarks) tests priority:❓ We need to figure out how soon this should be addressed type:bug Something isn't working
Projects
Status: In progress
Development

No branches or pull requests

1 participant