2017-05-12 12:36:43 +02:00
|
|
|
"""Provides helper classes for testing option handling in pip
|
|
|
|
"""
|
|
|
|
|
2018-07-30 08:15:17 +02:00
|
|
|
from pip._internal.cli import cmdoptions
|
2018-07-30 06:02:47 +02:00
|
|
|
from pip._internal.cli.base_command import Command
|
2019-07-10 09:36:33 +02:00
|
|
|
from pip._internal.commands import CommandInfo, commands_dict
|
2017-05-12 12:36:43 +02:00
|
|
|
|
|
|
|
|
|
|
|
class FakeCommand(Command):
|
|
|
|
|
|
|
|
def main(self, args):
|
|
|
|
index_opts = cmdoptions.make_option_group(
|
|
|
|
cmdoptions.index_group,
|
|
|
|
self.parser,
|
|
|
|
)
|
|
|
|
self.parser.add_option_group(index_opts)
|
|
|
|
return self.parse_args(args)
|
|
|
|
|
|
|
|
|
2020-12-24 22:23:07 +01:00
|
|
|
class AddFakeCommandMixin:
|
2017-05-12 12:36:43 +02:00
|
|
|
|
|
|
|
def setup(self):
|
2019-07-10 09:36:33 +02:00
|
|
|
commands_dict['fake'] = CommandInfo(
|
|
|
|
'tests.lib.options_helpers', 'FakeCommand', 'fake summary',
|
|
|
|
)
|
2017-05-12 12:36:43 +02:00
|
|
|
|
|
|
|
def teardown(self):
|
2019-07-10 09:36:33 +02:00
|
|
|
commands_dict.pop('fake')
|