pytest-dev / pytest-dev/pluggy

Temporary registration via context manager

Open
#52 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

This is a proposal for a very simple new feature. I actually implemented it in a side project pysipp and was thinking it was something we could add to the PluginManger.

The jist of it is adding a way to temporarily register plugins using a context manager api:

with pluginmanager.register_all([pluginmod1, pluginmod2]) as pm:
    #... do stuff that requires above plugins to be active...

# continue with stuff that doesn't require above plugins to be registered.

So it would basically just be adding PluginManager.register_all() (or whatever name you guys think is best) method that is a simple wrapper around register/unregister.

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 reading the linked pysipp/plugin.py example, then inspect PluginManager and its existing register and unregister methods. Done means a context-manager API can temporarily register the supplied plugins, keep them active inside the block, and unregister them afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.