pytest-dev / pytest-dev/pluggy

planning towards supporting fully mixed sync/async hook calling

Open
#378 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.7k
Forks
160
Avg merge
21h 4m
Merged PRs (30d)
6

Description

cc @simonw

this is a rough outline of supporting async hook calls and awaitable results in

the starting point will be a async hook caller that will call sync and async hook, deferring all awaitables to the event loop

nesting like async->sync->async will trigger failures when awaitables are encountered in the inner loop

the next level will be deferring all sync calls to a thread executor
any sync call that triggers a awaitable, will steal one thread of that pool , this is considered acceptable as execution is typically expected to be fairly non-concurrent (based on pytest)

a own threadpool with a maxium size of 10 ? shal be used (this accounts for the expectation that hooks run in order and should not nest to arbitrary levels)

nonblocking sync hooks may be marked as nonblocking
in which case they may run in the mainloop, as before nesting async into sync will trigger errros

the primary use case for nonblocking sync hooks is to support being nested into other legacy hooks without causing issues but transparently working with modern hook calls

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

No files, tests, or entry points are named. Start by reviewing the proposed async hook caller and the described sync/async nesting and thread-executor cases. Done would require an agreed design and implementation that supports the outlined mixed hook-calling behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
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.