Beispiel #1
0
 def test_set_version_same(self, mocker: MockerFixture, tmp_path: Path) -> None:
     """Test set_version same."""
     version = mocker.patch.object(TFEnvManager, "version")
     tfenv = TFEnvManager(tmp_path)
     tfenv.current_version = "0.15.5"
     assert not tfenv.set_version("0.15.5")
     assert tfenv.current_version == "0.15.5"
     assert tfenv.version == version
Beispiel #2
0
 def test_version_unavailable(self, mocker: MockerFixture, tmp_path: Path) -> None:
     """Test version latest."""
     mocker.patch.object(TFEnvManager, "versions_dir", tmp_path)
     mocker.patch(
         f"{MODULE}.get_available_tf_versions",
         return_value=["0.15.5", "0.15.4", "0.14.3", "0.14.2", "0.13.8"],
     )
     tfenv = TFEnvManager(tmp_path)
     tfenv.current_version = "1.0.0"
     with pytest.raises(SystemExit):
         assert not tfenv.version
Beispiel #3
0
 def test_version(self, mocker: MockerFixture, tmp_path: Path) -> None:
     """Test version."""
     version = VersionTuple(0, 15, 5)
     mocker.patch.object(TFEnvManager, "versions_dir", tmp_path)
     mock_get_available_tf_versions = mocker.patch(
         f"{MODULE}.get_available_tf_versions", return_value=[]
     )
     mock_get_version_from_file = mocker.patch.object(
         TFEnvManager, "get_version_from_file", return_value=None
     )
     tfenv = TFEnvManager(tmp_path)
     (tfenv.versions_dir / str(version)).mkdir()
     tfenv.current_version = str(version)
     assert tfenv.version == version
     assert tfenv.current_version == str(version)
     mock_get_version_from_file.assert_not_called()
     mock_get_available_tf_versions.assert_not_called()