diff --git a/pontos/version/commands.py b/pontos/version/commands.py index 39e98204a..bf321f7e3 100644 --- a/pontos/version/commands.py +++ b/pontos/version/commands.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from typing import Tuple, Type +from typing import Iterable, Tuple, Type from pontos.version.errors import ProjectError @@ -47,3 +47,7 @@ def gather_project() -> VersionCommand: return command raise ProjectError("No project settings file found") + + +def get_commands() -> Iterable[Type[VersionCommand]]: + return _COMMANDS diff --git a/tests/version/test_commands.py b/tests/version/test_commands.py index dd5919c2c..f286132da 100644 --- a/tests/version/test_commands.py +++ b/tests/version/test_commands.py @@ -19,7 +19,7 @@ from pontos.testing import temp_directory, temp_python_module from pontos.version.cmake import CMakeVersionCommand -from pontos.version.commands import gather_project +from pontos.version.commands import gather_project, get_commands from pontos.version.errors import ProjectError from pontos.version.go import GoVersionCommand from pontos.version.javascript import JavaScriptVersionCommand @@ -71,3 +71,8 @@ def test_cmake_project_version(self): version_file.write_text("project(VERSION 1.2.3)", encoding="utf8") self.assertIsInstance(gather_project(), CMakeVersionCommand) + + +class GetCommandsTestCase(unittest.TestCase): + def test_available_commands(self): + self.assertEqual(len(get_commands()), 4)