Skip to content

get_event_loop deprecation warning #1597

@DonVito1982

Description

@DonVito1982

Describe the bug
When performing unit tests under pytest that instantiate a binance.client.Client the tests throw a warning like the following

  /home/donvito/.pyenv/versions/algotrading/lib/python3.12/site-packages/binance/helpers.py:96: DeprecationWarning: There is no current event loop
    loop = asyncio.get_event_loop()

To Reproduce
Code snippet to reproduce the behavior:

import pytest
from binance.client import Client

class TestPopulateHelpers:
    def test_warning_reproduction(self):
        bclient = Client(
            api_key = "some_api_key",
            api_secret = "some_api_secret",
            tld = "com"
            )
        assert 1 == 1

Expected behavior
No warnings should be shown.

Environment (please complete the following information):

  • Python version: 3.12
  • Virtual Env: virtualenv
  • OS: Ubuntu
  • python-binance version: 1.0.29

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