pytest-dev / pytest-dev/pytest-asyncio

API for loop configuration options

Open
#1,032 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.7k
Forks
207
Avg merge
5h 35m
Merged PRs (30d)
9

Description

This issue doesn't propose a specific codebase change but is a point for discussing future steps in the plugin evolution.

Python has deprecated event loop policies since (unreleased) py-3.14.

The main asyncio motion idea for this and related changes is:

  1. Don't instantiate the loop explicitly, but use Runner (introduced in 3.11, there is a backport library for older Python version).
  2. Control runner behavior by debug and loop_factory arguments.
  3. There are eager tasks since 3.12; maybe the runner will have the option to configure it as well if we make an agreement

I think pytest-asyncio should reflect these changes.

  1. event_loop_policy() fixture should be deprecated along with event_loop.
  2. The library should not introduce public fixtures except unused_tcp_port and family. It is very fragile, especially if a user starts fixture overriding.
  3. Fine-grained control could be done by special pytest.mark.asyncio(...) arguments.
  4. Coarse-grained control uses configfile parameters and, maybe, cmdline args.
  5. Implementation details could vary; we are free to change them in the wild until the details are not leaked into the public space. The plugin already has a good movement in this direction, so I merely summarized what we do.

Please share your opinions in the comments, guys.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the event_loop_policy() and event_loop fixtures, pytest.mark.asyncio arguments, and configuration or command-line behavior described in the issue. The issue is a discussion of future API direction rather than a defined implementation. Done would require agreement on the public configuration design and the resulting implementation scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.