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

Tests are failing with aiohttp 3.10.x #18

Open
mweinelt opened this issue Aug 8, 2024 · 0 comments
Open

Tests are failing with aiohttp 3.10.x #18

mweinelt opened this issue Aug 8, 2024 · 0 comments

Comments

@mweinelt
Copy link
Contributor

mweinelt commented Aug 8, 2024

Hi!

After upgrading aiohttp to 3.10.1 we are seeing the following tests fail with pyfronius 0.7.3:

FAILED pyfronius/tests/test_web_v0.py::NoFroniusWebTest::test_no_server - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v0.py::NoFroniusWebTest::test_wrong_server - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v0.py::FroniusWebDetectVersionV0::test_fronius_get_correct_api_version - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v0.py::FroniusWebTestV0::test_fronius_get_active_device_info - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v0.py::FroniusWebTestV0::test_fronius_get_inverter_info - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v0.py::FroniusWebTestV0::test_fronius_get_inverter_realtime_data_device - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v0.py::FroniusWebTestV0::test_fronius_get_inverter_realtime_data_system - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v0.py::FroniusWebTestV0::test_fronius_get_led_info_data - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v0.py::FroniusWebTestV0::test_fronius_get_logger_info - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v0.py::FroniusWebTestV0::test_fronius_get_meter_realtime_data_device - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v0.py::FroniusWebTestV0::test_fronius_get_meter_realtime_data_system - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v0.py::FroniusWebTestV0::test_fronius_get_no_data - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v0.py::FroniusWebTestV0::test_fronius_get_power_flow_realtime_data - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v1.py::NoFroniusWebTest::test_no_server - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v1.py::NoFroniusWebTest::test_wrong_server - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v1.py::FroniusWebDetectVersionV1::test_fronius_get_correct_api_version - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v1.py::FroniusWebTestV1::test_fronius_fetch - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v1.py::FroniusWebTestV1::test_fronius_get_active_device_info - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v1.py::FroniusWebTestV1::test_fronius_get_inverter_info - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v1.py::FroniusWebTestV1::test_fronius_get_inverter_realtime_data_device - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v1.py::FroniusWebTestV1::test_fronius_get_inverter_realtime_data_system - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v1.py::FroniusWebTestV1::test_fronius_get_led_info_data - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v1.py::FroniusWebTestV1::test_fronius_get_logger_info - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v1.py::FroniusWebTestV1::test_fronius_get_meter_realtime_data_device - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v1.py::FroniusWebTestV1::test_fronius_get_meter_realtime_data_system - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v1.py::FroniusWebTestV1::test_fronius_get_ohmpilot_realtime_data_system - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v1.py::FroniusWebTestV1::test_fronius_get_power_flow_realtime_data - RuntimeError: no running event loop
FAILED pyfronius/tests/test_web_v1.py::FroniusWebTestV1::test_fronius_get_storage_realtime_data_system - RuntimeError: no running event loop

They all fail in a similiar way when calling ClientSession():

__________ FroniusWebTestV1.test_fronius_get_power_flow_realtime_data __________

self = <pyfronius.tests.test_web_v1.FroniusWebTestV1 testMethod=test_fronius_get_power_flow_realtime_data>

    def setUp(self):
        # Create an arbitrary subclass of TCP Server as the server to be
        # started
        # Here, it is an Simple HTTP file serving server
        handler = FroniusRequestHandler
    
        max_retries = 10
        r = 0
        while not self.server:
            try:
                # Connect to any open port
                self.server = FroniusServer(
                    (ADDRESS, 0), handler, self.api_version.value
                )
            except OSError:
                if r < max_retries:
                    r += 1
                else:
                    raise
                time.sleep(1)
    
        self.server_control = Server(self.server)
        self.port = self.server_control.get_port()
        self.url = "http://{}:{}".format(ADDRESS, self.port)
        # Start test server before running any tests
        self.server_control.start_server()
        # set up a fronius client and aiohttp session
>       self.session = aiohttp.ClientSession()

pyfronius/tests/test_web_v1.py:183: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <aiohttp.client.ClientSession object at 0x7ffff58e32c0>, base_url = None

    def __init__(
        self,
        base_url: Optional[StrOrURL] = None,
        *,
        connector: Optional[BaseConnector] = None,
        loop: Optional[asyncio.AbstractEventLoop] = None,
        cookies: Optional[LooseCookies] = None,
        headers: Optional[LooseHeaders] = None,
        skip_auto_headers: Optional[Iterable[str]] = None,
        auth: Optional[BasicAuth] = None,
        json_serialize: JSONEncoder = json.dumps,
        request_class: Type[ClientRequest] = ClientRequest,
        response_class: Type[ClientResponse] = ClientResponse,
        ws_response_class: Type[ClientWebSocketResponse] = ClientWebSocketResponse,
        version: HttpVersion = http.HttpVersion11,
        cookie_jar: Optional[AbstractCookieJar] = None,
        connector_owner: bool = True,
        raise_for_status: Union[
            bool, Callable[[ClientResponse], Awaitable[None]]
        ] = False,
        read_timeout: Union[float, _SENTINEL] = sentinel,
        conn_timeout: Optional[float] = None,
        timeout: Union[object, ClientTimeout] = sentinel,
        auto_decompress: bool = True,
        trust_env: bool = False,
        requote_redirect_url: bool = True,
        trace_configs: Optional[List[TraceConfig]] = None,
        read_bufsize: int = 2**16,
        max_line_size: int = 8190,
        max_field_size: int = 8190,
        fallback_charset_resolver: _CharsetResolver = lambda r, b: "utf-8",
    ) -> None:
        # We initialise _connector to None immediately, as it's referenced in __del__()
        # and could cause issues if an exception occurs during initialisation.
        self._connector: Optional[BaseConnector] = None
    
        if loop is None:
            if connector is not None:
                loop = connector._loop
    
>       loop = loop or asyncio.get_running_loop()
E       RuntimeError: no running event loop
fabaff added a commit to fabaff/nixpkgs that referenced this issue Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant