blob: f50092ffbe5809dbe581a4e17c5401b3a536ece6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import pytest
import psycopg
from psycopg.conninfo import conninfo_to_dict
pytestmark = [pytest.mark.dns]
@pytest.mark.asyncio
async def test_resolve_hostaddr_async_warning(recwarn):
import_dnspython()
conninfo = "dbname=foo"
params = conninfo_to_dict(conninfo)
params = await psycopg._dns.resolve_hostaddr_async( # type: ignore[attr-defined]
params
)
assert conninfo_to_dict(conninfo) == params
assert "resolve_hostaddr_async" in str(recwarn.pop(DeprecationWarning).message)
def import_dnspython():
try:
import dns.rdtypes.IN.A # noqa: F401
except ImportError:
pytest.skip("dnspython package not available")
import psycopg._dns # noqa: F401
|