test_list.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. # Copyright (c) OpenMMLab. All rights reserved.
  2. from click.testing import CliRunner
  3. from mim.commands.install import cli as install
  4. from mim.commands.list import list_package
  5. from mim.commands.uninstall import cli as uninstall
  6. def setup_module():
  7. runner = CliRunner()
  8. result = runner.invoke(uninstall, ['mmcv-full', '--yes'])
  9. assert result.exit_code == 0
  10. result = runner.invoke(uninstall, ['mmcls', '--yes'])
  11. assert result.exit_code == 0
  12. def test_list():
  13. runner = CliRunner()
  14. # mim install mmcls==0.23.0 --yes
  15. result = runner.invoke(install, ['mmcls==0.23.0', '--yes'])
  16. assert result.exit_code == 0
  17. # mim list
  18. target = ('mmcls', '0.23.0',
  19. 'https://github.com/open-mmlab/mmclassification')
  20. result = list_package()
  21. assert target in result
  22. def teardown_module():
  23. runner = CliRunner()
  24. result = runner.invoke(uninstall, ['mmcv-full', '--yes'])
  25. assert result.exit_code == 0
  26. result = runner.invoke(uninstall, ['mmcls', '--yes'])
  27. assert result.exit_code == 0