aio-libs / aiodns

Simple DNS resolver for asyncio
https://pypi.python.org/pypi/aiodns
MIT License
532 stars 69 forks source link

Add Winloop as a valid EventLoop #116

Closed Vizonex closed 6 months ago

Vizonex commented 6 months ago

So I recently tried to see if winloop would be another valid option since it is not tied to the ProctorEventLoop in any way shape or form and I was able to spin up a quick unittest once I modified aiodns's dns resolver to work with my library.

try:
    import aiodns
except ImportError:
    skip_tests = True
else:
    skip_tests = False

import asyncio
import sys
import unittest
import weakref

from winloop import _testbase as tb

class _TestAiodns:
    def test_dns_query(self):
        # This is not allowed to fail...
        resolver = aiodns.DNSResolver(loop=self.loop)

        async def test():
            async def query(name, query_type):
                return await resolver.query(name, query_type)
            await query('google.com', 'A')
            await query('httpbin.org', 'A')
            await query('example.com', 'A')

        self.loop.run_until_complete(test())

@unittest.skipIf(skip_tests, "no aiodns module")
class Test_UV_Aiodns(_TestAiodns, tb.UVTestCase):
    pass

@unittest.skip("aiodns needs a SelectorEventLoop on Windows. See more: https://github.com/saghul/aiodns/issues/86")
class Test_AIO_Aiodns(_TestAiodns, tb.AIOTestCase):
    pass

btw I am the main developer of winloop.

saghul commented 6 months ago

Nice! Could you add a test here that runs on winloop?

Vizonex commented 6 months ago

On Wed, Mar 20, 2024 at 9:55 PM Saúl Ibarra Corretgé < @.***> wrote:

Nice! Could you add a test here that runs on winloop?

— Reply to this email directly, view it on GitHub https://github.com/saghul/aiodns/pull/116#issuecomment-2011095837, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3K7GGV45XZ7NX4CXNMST7TYZJDY5AVCNFSM6AAAAABFAS56NSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJRGA4TKOBTG4 . You are receiving this because you authored the thread.Message ID: @.***>

I probably could in a bit.

Vizonex commented 6 months ago

One Little thing I added was also uvloop which works on other platforms excluding windows might be smart to add so I included it.