From b8982d6ec2e8d1376e33627f63029229e2cfce24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Thu, 2 Mar 2023 13:34:25 +0100 Subject: [PATCH] Remove: Drop VersionCalculator from VersionCommands The VersionCalculator can be acquired via a Project instance now. --- pontos/version/version.py | 6 +----- tests/version/test_cmake_version.py | 9 +-------- tests/version/test_go_version.py | 9 +-------- tests/version/test_javascript_version.py | 9 +-------- tests/version/test_python_version.py | 11 +---------- 5 files changed, 5 insertions(+), 39 deletions(-) diff --git a/pontos/version/version.py b/pontos/version/version.py index e82760cfc..f6cba4eb7 100644 --- a/pontos/version/version.py +++ b/pontos/version/version.py @@ -19,7 +19,7 @@ from dataclasses import dataclass, field from datetime import datetime from pathlib import Path -from typing import Literal, Type, Union +from typing import Literal, Union from packaging.version import InvalidVersion from packaging.version import Version as PackagingVersion @@ -223,7 +223,6 @@ class VersionCommand(ABC): version commands for several programming languages""" project_file_name: str - version_calculator_class: Type[VersionCalculator] = VersionCalculator def __init__(self) -> None: self.project_file_path = Path.cwd() / self.project_file_name @@ -249,6 +248,3 @@ def project_found(self) -> bool: Returns True if a command has detected a corresponding project """ return self.project_file_path.exists() - - def get_version_calculator(self) -> VersionCalculator: - return self.version_calculator_class() diff --git a/tests/version/test_cmake_version.py b/tests/version/test_cmake_version.py index 56731b24e..a2d739ffb 100644 --- a/tests/version/test_cmake_version.py +++ b/tests/version/test_cmake_version.py @@ -24,14 +24,7 @@ from pontos.testing import temp_directory, temp_file from pontos.version.cmake import CMakeVersionCommand, CMakeVersionParser from pontos.version.errors import VersionError -from pontos.version.version import Version, VersionCalculator - - -class CMakeVersionCommandTestCase(unittest.TestCase): - def test_get_version_calculator(self): - cmake = CMakeVersionCommand() - - self.assertIsInstance(cmake.get_version_calculator(), VersionCalculator) +from pontos.version.version import Version class VerifyCMakeVersionCommandTestCase(unittest.TestCase): diff --git a/tests/version/test_go_version.py b/tests/version/test_go_version.py index e59cc5e4f..dae2b4546 100644 --- a/tests/version/test_go_version.py +++ b/tests/version/test_go_version.py @@ -25,7 +25,7 @@ from pontos.testing import temp_directory, temp_file from pontos.version.errors import VersionError from pontos.version.go import GoVersionCommand -from pontos.version.version import Version, VersionCalculator +from pontos.version.version import Version @dataclass @@ -42,13 +42,6 @@ class StdOutput: \n""" -class GoVersionCommandTestCase(unittest.TestCase): - def test_get_version_calculator(self): - go = GoVersionCommand() - - self.assertIsInstance(go.get_version_calculator(), VersionCalculator) - - class GetCurrentGoVersionCommandTestCase(unittest.TestCase): def test_getting_version(self): with temp_file( diff --git a/tests/version/test_javascript_version.py b/tests/version/test_javascript_version.py index b44c7a39f..421324353 100644 --- a/tests/version/test_javascript_version.py +++ b/tests/version/test_javascript_version.py @@ -23,14 +23,7 @@ from pontos.testing import temp_directory, temp_file from pontos.version.errors import VersionError from pontos.version.javascript import JavaScriptVersionCommand -from pontos.version.version import Version, VersionCalculator - - -class JavaScriptVersionCommandTestCase(unittest.TestCase): - def test_get_version_calculator(self): - js = JavaScriptVersionCommand() - - self.assertIsInstance(js.get_version_calculator(), VersionCalculator) +from pontos.version.version import Version class GetCurrentJavaScriptVersionCommandTestCase(unittest.TestCase): diff --git a/tests/version/test_python_version.py b/tests/version/test_python_version.py index 24ba092aa..7873cce12 100644 --- a/tests/version/test_python_version.py +++ b/tests/version/test_python_version.py @@ -26,16 +26,7 @@ from pontos.testing import temp_directory, temp_file, temp_python_module from pontos.version.errors import VersionError from pontos.version.python import PythonVersionCommand -from pontos.version.version import Version, VersionCalculator - - -class PythonVersionCommandTestCase(unittest.TestCase): - def test_get_version_calculator(self): - python = PythonVersionCommand() - - self.assertIsInstance( - python.get_version_calculator(), VersionCalculator - ) +from pontos.version.version import Version class GetCurrentPythonVersionCommandTestCase(unittest.TestCase):