-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test to tutor install version command
- Loading branch information
Showing
5 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
31 changes: 31 additions & 0 deletions
31
tests/version_manager/application/test_tutor_version_installer.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pytest | ||
|
||
from tests.version_manager.infrastructure.version_manager_in_memory_repository import VersionManagerInMemoryRepository | ||
from tvm.version_manager.application.tutor_version_installer import TutorVersionInstaller | ||
from tvm.version_manager.domain.tutor_version_format_error import TutorVersionFormatError | ||
|
||
|
||
def test_should_fail_if_version_format_is_not_valid(): | ||
# Given | ||
version = "v123" | ||
repository = VersionManagerInMemoryRepository() | ||
|
||
# When | ||
installer = TutorVersionInstaller(repository=repository) | ||
|
||
# Then | ||
with pytest.raises(TutorVersionFormatError) as format_err: | ||
installer(version=version) | ||
|
||
|
||
def test_should_install_the_tutor_version(): | ||
# Given | ||
version = "v1.2.3" | ||
repository = VersionManagerInMemoryRepository() | ||
|
||
# When | ||
installer = TutorVersionInstaller(repository=repository) | ||
installer(version=version) | ||
|
||
# Then | ||
assert version in repository.VERSIONS_INSTALLED |
Empty file.
41 changes: 41 additions & 0 deletions
41
tests/version_manager/infrastructure/version_manager_in_memory_repository.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from typing import List, Optional | ||
|
||
from tvm.version_manager.domain.tutor_version import TutorVersion | ||
from tvm.version_manager.domain.version_manager_repository import VersionManagerRepository | ||
|
||
|
||
class VersionManagerInMemoryRepository(VersionManagerRepository): | ||
VERSIONS_INSTALLED = [] | ||
|
||
def list_versions(self, limit: int) -> List[TutorVersion]: | ||
pass | ||
|
||
@staticmethod | ||
def local_versions(tvm_path: str) -> List[TutorVersion]: | ||
pass | ||
|
||
@staticmethod | ||
def current_version(tvm_path: str) -> List[TutorVersion]: | ||
pass | ||
|
||
def install_version(self, version: TutorVersion) -> None: | ||
self.VERSIONS_INSTALLED.append(version) | ||
|
||
def find_version(self, version: TutorVersion) -> Optional[TutorVersion]: | ||
return version if version in self.VERSIONS_INSTALLED else None | ||
|
||
def uninstall_version(self, version: TutorVersion) -> None: | ||
pass | ||
|
||
def use_version(self, version: TutorVersion) -> None: | ||
pass | ||
|
||
@staticmethod | ||
def version_is_installed(version: str) -> None: | ||
pass | ||
|
||
def install_plugin(self, options: List) -> None: | ||
pass | ||
|
||
def uninstall_plugin(self, options: List) -> None: | ||
pass |