mongo/buildscripts/resmokelib/plugin.py
Zack Winter fbc2f1ea04 SERVER-111295 [v8.0] Set python as formatter in format_multirun (#41681)
GitOrigin-RevId: 0a5f595c13f329cc64a37f58e7369dd9469ee848
2026-01-15 19:55:28 +00:00

38 lines
979 B
Python

"""Interface for creating a resmoke plugin."""
import abc
class Subcommand(object):
"""A resmoke subcommand to execute."""
def execute(self):
"""Execute the subcommand."""
raise NotImplementedError(
"execute must be implemented by Subcommand subclasses"
)
class PluginInterface(abc.ABC):
"""Subcommand/plugin interface."""
def add_subcommand(self, subparsers):
"""
Add parser options for this plugin.
:param subparsers: argparse subparsers
"""
raise NotImplementedError()
def parse(self, subcommand, parser, parsed_args, **kwargs):
"""
Resolve command-line options to a Subcommand or None.
:param subcommand: equivalent to parsed_args.command
:param parser: parser used
:param parsed_args: output of parsing
:param kwargs: additional args
:return: None or a Subcommand
"""
raise NotImplementedError()