Skip to content

Commit b8982d6

Browse files
committed
Remove: Drop VersionCalculator from VersionCommands
The VersionCalculator can be acquired via a Project instance now.
1 parent eeed85f commit b8982d6

File tree

5 files changed

+5
-39
lines changed

5 files changed

+5
-39
lines changed

pontos/version/version.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from dataclasses import dataclass, field
2020
from datetime import datetime
2121
from pathlib import Path
22-
from typing import Literal, Type, Union
22+
from typing import Literal, Union
2323

2424
from packaging.version import InvalidVersion
2525
from packaging.version import Version as PackagingVersion
@@ -223,7 +223,6 @@ class VersionCommand(ABC):
223223
version commands for several programming languages"""
224224

225225
project_file_name: str
226-
version_calculator_class: Type[VersionCalculator] = VersionCalculator
227226

228227
def __init__(self) -> None:
229228
self.project_file_path = Path.cwd() / self.project_file_name
@@ -249,6 +248,3 @@ def project_found(self) -> bool:
249248
Returns True if a command has detected a corresponding project
250249
"""
251250
return self.project_file_path.exists()
252-
253-
def get_version_calculator(self) -> VersionCalculator:
254-
return self.version_calculator_class()

tests/version/test_cmake_version.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,7 @@
2424
from pontos.testing import temp_directory, temp_file
2525
from pontos.version.cmake import CMakeVersionCommand, CMakeVersionParser
2626
from pontos.version.errors import VersionError
27-
from pontos.version.version import Version, VersionCalculator
28-
29-
30-
class CMakeVersionCommandTestCase(unittest.TestCase):
31-
def test_get_version_calculator(self):
32-
cmake = CMakeVersionCommand()
33-
34-
self.assertIsInstance(cmake.get_version_calculator(), VersionCalculator)
27+
from pontos.version.version import Version
3528

3629

3730
class VerifyCMakeVersionCommandTestCase(unittest.TestCase):

tests/version/test_go_version.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from pontos.testing import temp_directory, temp_file
2626
from pontos.version.errors import VersionError
2727
from pontos.version.go import GoVersionCommand
28-
from pontos.version.version import Version, VersionCalculator
28+
from pontos.version.version import Version
2929

3030

3131
@dataclass
@@ -42,13 +42,6 @@ class StdOutput:
4242
\n"""
4343

4444

45-
class GoVersionCommandTestCase(unittest.TestCase):
46-
def test_get_version_calculator(self):
47-
go = GoVersionCommand()
48-
49-
self.assertIsInstance(go.get_version_calculator(), VersionCalculator)
50-
51-
5245
class GetCurrentGoVersionCommandTestCase(unittest.TestCase):
5346
def test_getting_version(self):
5447
with temp_file(

tests/version/test_javascript_version.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,7 @@
2323
from pontos.testing import temp_directory, temp_file
2424
from pontos.version.errors import VersionError
2525
from pontos.version.javascript import JavaScriptVersionCommand
26-
from pontos.version.version import Version, VersionCalculator
27-
28-
29-
class JavaScriptVersionCommandTestCase(unittest.TestCase):
30-
def test_get_version_calculator(self):
31-
js = JavaScriptVersionCommand()
32-
33-
self.assertIsInstance(js.get_version_calculator(), VersionCalculator)
26+
from pontos.version.version import Version
3427

3528

3629
class GetCurrentJavaScriptVersionCommandTestCase(unittest.TestCase):

tests/version/test_python_version.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,7 @@
2626
from pontos.testing import temp_directory, temp_file, temp_python_module
2727
from pontos.version.errors import VersionError
2828
from pontos.version.python import PythonVersionCommand
29-
from pontos.version.version import Version, VersionCalculator
30-
31-
32-
class PythonVersionCommandTestCase(unittest.TestCase):
33-
def test_get_version_calculator(self):
34-
python = PythonVersionCommand()
35-
36-
self.assertIsInstance(
37-
python.get_version_calculator(), VersionCalculator
38-
)
29+
from pontos.version.version import Version
3930

4031

4132
class GetCurrentPythonVersionCommandTestCase(unittest.TestCase):

0 commit comments

Comments
 (0)