Skip to content

Collect the two DoH3 tests whose names start with a capital T - #1400

Merged
rthalley merged 1 commit into
rthalley:mainfrom
dylanpulver:tests/collect-doh3-post-and-queryip
Nov 4, 2026
Merged

rthalley merged 1 commit into
rthalley:mainfrom
dylanpulver:tests/collect-doh3-post-and-queryip

Conversation

@dylanpulver

Copy link
Copy Markdown
Contributor

tests/test_async.py has three DoH3 tests next to each other:

585:    def testDoH3GetRequest(self):
603:    def TestDoH3PostRequest(self):
621:    def TestDoH3QueryIP(self):

The first runs. The other two are spelled with a capital T, so neither
unittest nor pytest collects them, and they have never run.

Reviving them does not change what the suite reaches out to. AsyncTests
is already gated by @unittest.skipIf(not tests.util.is_internet_reachable()),
each of the three carries @unittest.skipIf(not dns.quic.have_quic) and
@tests.util.retry_on_timeout, and testDoH3GetRequest already queries a
public DoH3 resolver.

The second one does not pass on a rename alone

TestDoH3QueryIP is missing the await that both of its siblings have:

r = dns.asyncquery.https(
    q,
    nameserver_ip,
    post=False,
    timeout=4,
    http_version=dns.asyncquery.HTTPVersion.H3,
)
self.assertTrue(q.is_response(r))

So r is a coroutine and the assertion fails:

E       AttributeError: 'coroutine' object has no attribute 'flags'
dns/message.py:321: AttributeError

This adds the await, so the test checks the response rather than the
coroutine object.

Verification

With aioquic installed and the internet reachable:

  • tests/test_async.py collects 83 tests before and 87 after. The four are
    the two methods times AsyncTests and TrioAsyncTests, which subclasses it.
  • Renaming only, without the await, gives 2 failed and 4 passed on
    -k DoH3, and both failures are testDoH3QueryIP.
  • With the await, -k DoH3 is 6 passed.
  • tests/test_async.py as a whole is 81 passed, 6 skipped.
  • Full suite goes from 1734 passed to 1738 passed. Seven failures are
    identical before and after on 5adedf1a, in test_zone.py and
    test_tsig_doh_doq.py, so they are unrelated to this change.
  • black --check tests/test_async.py is clean.

`TestDoH3PostRequest` and `TestDoH3QueryIP` are spelled with a capital T,
so neither unittest nor pytest collects them. Their sibling three lines
above is `testDoH3GetRequest`, which does run, and the whole `AsyncTests`
class is already gated on internet reachability and on aioquic being
present, so reviving these adds no new kind of test.

`TestDoH3QueryIP` also lost the `await` on its `dns.asyncquery.https`
call, which is why renaming it alone fails with

    AttributeError: 'coroutine' object has no attribute 'flags'

Add the `await` so the test checks the response it meant to check.

tests/test_async.py goes from 83 collected to 87, since AsyncTests is also
re-run as TrioAsyncTests.
@rthalley
rthalley merged commit 5357cbb into rthalley:main Nov 4, 2026
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

Successfully merging this pull request may close these issues.

2 participants