GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Pytest does not notify users when async tests are ignored · Issue #11372 · pytest-dev/pytest

Pytest does not notify users when async tests are ignored #11372

New issue
Copy link
New issue
Copy link
Closed
#12346
Closed
Pytest does not notify users when async tests are ignored#11372
#12346
Copy link
Labels
topic: collectionrelated to the collection phasetopic: reportingrelated to terminal output and user-facing messages and errors
Milestone
9.0

Description

@LukeWood
LukeWood
opened on Aug 30, 2023
Issue body actions

What's the problem this feature will solve?

When writing async unit-tests, it is extremely easy to forget to install the pytest-async extension and end up ignoring the futures.
This can cause unexpected silence:

async def test_should_fail_but_doesnt():
    assert False

This passes if pytest-async is not installed. Instead, I'd like to propose we make this fail with a nice message indicating that you need too install python-async.

Describe the solution you'd like

I'd like to inspect tests to see if they return a future. If they return a future, and pytest-async is not installed i'd like to error out and tell users to install it.

Alternative Solutions

Ignore the tests.

Additional context

I've been bit by this once~ know another team member of mine who has also been bitten by this.
I'm happy to contribute this.

Activity

  1. RonnyPfannschmidt commented on Aug 30, 2023

    @RonnyPfannschmidt
    RonnyPfannschmidt
    on Aug 30, 2023
    Member
    More actions

    More details needed,pytest notifies when async tests are there without a async plugin

  2. LukeWood commented on Aug 30, 2023

    @LukeWood
    LukeWood
    on Aug 30, 2023
    Author
    More actions

    More details needed,pytest notifies when async tests are there without a async plugin

    Oh interesting! I had no idea- maybe I missed it in the logs?

    what does notify mean in this context? Error or warning? If a warning maybe we should upgrade it to an error and gate the warning behind an environment variable?

  3. RonnyPfannschmidt commented on Aug 30, 2023

    @RonnyPfannschmidt
    RonnyPfannschmidt
    on Aug 30, 2023
    Member
    More actions

    Warnings

  4. LukeWood commented on Aug 30, 2023

    @LukeWood
    LukeWood
    on Aug 30, 2023 via email
    Author
    More actions
    Thanks Maybe we should consider upgrading the default and allow opt out via a config variable?
    On Wed, Aug 30, 2023 at 12:16 PM Ronny Pfannschmidt < ***@***.***> wrote: Warnings — Reply to this email directly, view it on GitHub <#11372 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AC5AMR6743UNPSTTBLSERKTXX5RMFANCNFSM6AAAAAA4EU5UJQ> . You are receiving this because you authored the thread.Message ID: ***@***.***>
    -- Sent from mobile, Please excuse any typos.
  5. RonnyPfannschmidt commented on Aug 30, 2023

    @RonnyPfannschmidt
    RonnyPfannschmidt
    on Aug 30, 2023
    Member
    More actions

    @nicoddemus @asottile @bluetech

    I'm +1 on turning those into a failure for 8.x and would like your input

    Reacted by anthony sottile, Luke Wood, Zac Hatfield-Dodds and 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко)
  6. Zac-HD
    added
    topic: reportingrelated to terminal output and user-facing messages and errors
    topic: collectionrelated to the collection phase
    on Sep 7, 2023
  7. Zac-HD commented on Sep 7, 2023

    @Zac-HD
    Zac-HD
    on Sep 7, 2023
    Member
    More actions

    Sounds good to me - we could even recommend a particular plugin based on sys.modules:

    if pkgs := " or ".join(
        f"pytest-{n}" for n in ("anyio", "asyncio", "trio) 
        if n in sys.modules and f"pytest_{n}" not in sys.modules
    ):
        error_msg += "  Consider installing {pkgs}."
  8. Zac-HD
    added this to the 9.0 milestone on May 20, 2024
  9. Zac-HD commented on Oct 22, 2024

    @Zac-HD
    Zac-HD
    on Oct 22, 2024
    Member
    More actions

    Relevant code is here. We should convert from a warning to an error, and include the nodeid in the error message - it's not currently included in this warning!

    It'd also be good to turn other non-None returns into an error; that's similarly a few years past when we planned to finish the transition.

  10. jakkdl
    linked a pull request that will close this issuemake async tests and tests that return non-None fail instead of warn #12346on Oct 23, 2024
  11. Zac-HD
    closed this as completedin #12346on Oct 25, 2024
  12. sai-rekhawar
    added a commit that references this issue on Jul 1, 2025

    Merged PR 5358: Update dependency pytest to v8

    c47e3c3
  13. kraj
    added 2 commits that reference this issue on Jul 26, 2025

    Add asyncio fixture to test_instance_async_method_spy

    4d7a6cb

    Add asyncio fixture to test_instance_async_method_spy

    17850cd
  14. nicoddemus
    added a commit that references this issue on Jul 27, 2025

    Add asyncio fixture to test_instance_async_method_spy (#516)

    37ce139
  15. kraj
    added a commit that references this issue on Nov 19, 2025

    python3-pyzmq: Package pytest.ini with ptests

    f44516e
  16. luketainton
    added a commit that references this issue on Jan 5, 2026

    chore(deps): update dependency pytest to v9 (#305)

    4b75154
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: collectionrelated to the collection phasetopic: reportingrelated to terminal output and user-facing messages and errors

    Type

    No type

    Projects

    No projects

      Milestone

      • 9.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.