mirror of
https://github.com/modelscope/modelscope.git
synced 2025-12-23 03:29:27 +01:00
1. 支持 plugin方式接入外部 repo、github repo,本地repo,并进行外部插件管理 2. 支持allow_remote方式接入modelhub repo,该类型属于model 范畴不做额外插件管理 3. 支持cli 安装plugin相关 Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/11775456
51 lines
1.7 KiB
Python
51 lines
1.7 KiB
Python
import subprocess
|
|
import unittest
|
|
|
|
from modelscope.utils.plugins import PluginsManager
|
|
|
|
|
|
class PluginsCMDTest(unittest.TestCase):
|
|
|
|
def setUp(self):
|
|
print(('Testing %s.%s' % (type(self).__name__, self._testMethodName)))
|
|
self.package = 'adaseq'
|
|
self.plugins_manager = PluginsManager()
|
|
|
|
def tearDown(self):
|
|
super().tearDown()
|
|
|
|
def test_plugins_install(self):
|
|
cmd = f'python -m modelscope.cli.cli plugin install {self.package}'
|
|
stat, output = subprocess.getstatusoutput(cmd)
|
|
self.assertEqual(stat, 0)
|
|
|
|
# move this from tear down to avoid unexpected uninstall
|
|
uninstall_args = [self.package, '-y']
|
|
self.plugins_manager.uninstall_plugins(uninstall_args)
|
|
|
|
def test_plugins_uninstall(self):
|
|
# move this from tear down to avoid unexpected uninstall
|
|
uninstall_args = [self.package, '-y']
|
|
self.plugins_manager.uninstall_plugins(uninstall_args)
|
|
|
|
cmd = f'python -m modelscope.cli.cli plugin install {self.package}'
|
|
stat, output = subprocess.getstatusoutput(cmd)
|
|
self.assertEqual(stat, 0)
|
|
|
|
cmd = f'python -m modelscope.cli.cli plugin uninstall {self.package}'
|
|
stat, output = subprocess.getstatusoutput(cmd)
|
|
self.assertEqual(stat, 0)
|
|
|
|
# move this from tear down to avoid unexpected uninstall
|
|
uninstall_args = [self.package, '-y']
|
|
self.plugins_manager.uninstall_plugins(uninstall_args)
|
|
|
|
def test_plugins_list(self):
|
|
cmd = 'python -m modelscope.cli.cli plugin list'
|
|
stat, output = subprocess.getstatusoutput(cmd)
|
|
self.assertEqual(stat, 0)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|