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

Unit test for async ping fails on Windows #140

Closed
py-mine-bot opened this issue Feb 15, 2022 · 3 comments · Fixed by #361
Closed

Unit test for async ping fails on Windows #140

py-mine-bot opened this issue Feb 15, 2022 · 3 comments · Fixed by #361
Labels
area: tests Related to unit-tests or other type of testing Github Import This was auto-imported from upstream repository type: bug Something isn't working

Comments

@py-mine-bot
Copy link
Collaborator

kevinkjt2000 Authored by kevinkjt2000
Jun 15, 2021


====================================================== FAILURES =======================================================
______________________________________ TestAsyncMinecraftServer.test_async_ping _______________________________________

self = <mcstatus.tests.test_server.TestAsyncMinecraftServer object at 0x000002315B6AED00>, unused_tcp_port = 58432
create_mock_packet_server = <function create_mock_packet_server.<locals>.create_server at 0x000002315B63D1F0>

    @pytest.mark.asyncio
    async def test_async_ping(self, unused_tcp_port, create_mock_packet_server):
        mock_packet_server = await create_mock_packet_server(
            port=unused_tcp_port,
            data_expected_to_receive=bytearray.fromhex("09010000000001C54246"),
            data_to_respond_with=bytearray.fromhex("0F002F096C6F63616C686F737463DD0109010000000001C54246"),
        )
        minecraft_server = MinecraftServer("localhost", port=unused_tcp_port)

>       latency = await minecraft_server.async_ping(ping_token=29704774, version=47)

mcstatus\tests\test_server.py:69:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mcstatus\server.py:95: in async_ping
    raise exception_to_raise_after_giving_up
mcstatus\server.py:89: in async_ping
    ping = await pinger.test_ping()
mcstatus\pinger.py:102: in test_ping
    response = await self.connection.read_buffer()
mcstatus\protocol\connection.py:174: in read_buffer
    length = await self.read_varint()
mcstatus\protocol\connection.py:139: in read_varint
    part = ord(await self.read(1))

My guess is the patching of the socket that works on Linux does not work on Windows.

@py-mine-bot py-mine-bot added type: bug Something isn't working Github Import This was auto-imported from upstream repository labels Feb 17, 2022
@ItsDrike ItsDrike added the area: tests Related to unit-tests or other type of testing label Feb 22, 2022
@PerchunPak
Copy link
Member

Can't actually reproduce it now. Was accidently fixed?

@kevinkjt2000
Copy link
Contributor

Still here

@pytest.mark.skipif(
sys.platform.startswith("win"),
reason="async bug on Windows https://github.com/Dinnerbone/mcstatus/issues/140",
)

@PerchunPak
Copy link
Member

I deleted it, and ran the test. It's passing on Windows 11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: tests Related to unit-tests or other type of testing Github Import This was auto-imported from upstream repository type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants