mim/tests/test_list.py

39 lines
1.2 KiB
Python
Raw Normal View History

2022-02-23 22:20:01 +08:00
# Copyright (c) OpenMMLab. All rights reserved.
from click.testing import CliRunner
from mim.commands.install import cli as install
from mim.commands.list import list_package
from mim.commands.uninstall import cli as uninstall
def setup_module():
runner = CliRunner()
result = runner.invoke(uninstall, ['mmcv-full', '--yes'])
assert result.exit_code == 0
result = runner.invoke(uninstall, ['mmcv', '--yes'])
assert result.exit_code == 0
result = runner.invoke(uninstall, ['mmcls', '--yes'])
assert result.exit_code == 0
def test_list():
runner = CliRunner()
[Refactor] refactor mim install (#132) * refactor(commands/install.py): refactor mim install * update(commands/install.py): add missing doc comments * fix(commands/install.py): fix invalid marker during check_install_conflicts and add mminstall.txt cache * style(commands/mminstall.txt): fix a stupid autoformat * combine commit: for ci debug * for ci debug * commit suggetion(mim/commands/install.py): refine doc comment Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com> * commit suggetion(mim/commands/install.py): refine doc comment Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com> * commit suggestion(mim/commands/install.py): refine doc comments Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com> * commit suggestion(mim/commands/install.py): refine doc comments Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com> * commit suggestion(mim/commands/install.py): refine doc comments Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com> * commit suggestion(mim/commands/install.py): refine doc comments Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com> * chore(requirements): add pip>=19.3 * refine(commands/install.py): refine contextmanager * fix(commands/install.py): refine tthe cache logic * fix(commands/install.py): refine the cache logic combine commit record: for ci debug * commit suggestion(mim/commands/install.py): refine doc comments Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com> * combine commit record: for ci debug * refine(commands/install.py): add warning log about index_url passed in install_args * fix(commands/install.py): refine the cache logic combine commit record: for ci debug * doc(tests): add line comments * feat(commands/install.py): add check_mim_resources * reload pip._vendor.pkg_resources before install combine commit record: foc ci debug * doc(tests): add line comments * feat(commands/install.py): add check_mim_resources * doc(tests): add line comments * doc(tests): add line comments * feat(commands/install.py): add check_mim_resources * doc(tests): fix line comments typo * Revert "Merge branch 'yancong-refactor-install' of github.com:ice-tong/mim into yancong-refactor-install" This reverts commit 97529af51fdb431ce379edc7707231b63aaf6eeb, reversing changes made to e70fa88d64fd3893269fb85bf6dfc03112250b2a. * refine comments for importlib.reload(pip._vendor.pkg_resources) * combine commit: for ci debug * combine commit record: for ci debug * feat(commands/install.py): add check_mim_resources combine commit: for ci debug * combine commit: for ci debug * refine comments and remove pyetst cache file * remove duplicate code snippets * update(tests/test_install.py): add vcs install case * fix(tests/test_train.py): fix mmcls install issue Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
2022-06-22 20:09:10 +08:00
# mim install mmcls==0.23.0 --yes
result = runner.invoke(install, ['mmcls==0.23.0', '--yes'])
assert result.exit_code == 0
# mim list
[Refactor] refactor mim install (#132) * refactor(commands/install.py): refactor mim install * update(commands/install.py): add missing doc comments * fix(commands/install.py): fix invalid marker during check_install_conflicts and add mminstall.txt cache * style(commands/mminstall.txt): fix a stupid autoformat * combine commit: for ci debug * for ci debug * commit suggetion(mim/commands/install.py): refine doc comment Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com> * commit suggetion(mim/commands/install.py): refine doc comment Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com> * commit suggestion(mim/commands/install.py): refine doc comments Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com> * commit suggestion(mim/commands/install.py): refine doc comments Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com> * commit suggestion(mim/commands/install.py): refine doc comments Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com> * commit suggestion(mim/commands/install.py): refine doc comments Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com> * chore(requirements): add pip>=19.3 * refine(commands/install.py): refine contextmanager * fix(commands/install.py): refine tthe cache logic * fix(commands/install.py): refine the cache logic combine commit record: for ci debug * commit suggestion(mim/commands/install.py): refine doc comments Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com> * combine commit record: for ci debug * refine(commands/install.py): add warning log about index_url passed in install_args * fix(commands/install.py): refine the cache logic combine commit record: for ci debug * doc(tests): add line comments * feat(commands/install.py): add check_mim_resources * reload pip._vendor.pkg_resources before install combine commit record: foc ci debug * doc(tests): add line comments * feat(commands/install.py): add check_mim_resources * doc(tests): add line comments * doc(tests): add line comments * feat(commands/install.py): add check_mim_resources * doc(tests): fix line comments typo * Revert "Merge branch 'yancong-refactor-install' of github.com:ice-tong/mim into yancong-refactor-install" This reverts commit 97529af51fdb431ce379edc7707231b63aaf6eeb, reversing changes made to e70fa88d64fd3893269fb85bf6dfc03112250b2a. * refine comments for importlib.reload(pip._vendor.pkg_resources) * combine commit: for ci debug * combine commit record: for ci debug * feat(commands/install.py): add check_mim_resources combine commit: for ci debug * combine commit: for ci debug * refine comments and remove pyetst cache file * remove duplicate code snippets * update(tests/test_install.py): add vcs install case * fix(tests/test_train.py): fix mmcls install issue Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
2022-06-22 20:09:10 +08:00
target = ('mmcls', '0.23.0',
'https://github.com/open-mmlab/mmclassification')
result = list_package()
assert target in result
def teardown_module():
runner = CliRunner()
result = runner.invoke(uninstall, ['mmcv-full', '--yes'])
assert result.exit_code == 0
result = runner.invoke(uninstall, ['mmcv', '--yes'])
assert result.exit_code == 0
result = runner.invoke(uninstall, ['mmcls', '--yes'])
assert result.exit_code == 0