From 02d3fdcbdd7205b2c963582b5d5ef002dce84f80 Mon Sep 17 00:00:00 2001 From: pz2 Date: Sat, 18 May 2024 15:18:44 +0200 Subject: [PATCH] Added release kinds to allow creating many valhalla.yml files to define different processes --- test/version/version_to_release_test.py | 13 +++++++------ valhalla/version/version_to_release.py | 2 ++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/test/version/version_to_release_test.py b/test/version/version_to_release_test.py index 8af7e55..a038d02 100644 --- a/test/version/version_to_release_test.py +++ b/test/version/version_to_release_test.py @@ -1,3 +1,4 @@ +import os import unittest from unittest.mock import patch @@ -7,28 +8,28 @@ class GetValhallaReleaseKindsTest(unittest.TestCase): def test_main_file(self): - result = get_release_kinds("./resources/test_main_file") + result = get_release_kinds(os.path.dirname(os.path.abspath(__file__)) + "/resources/test_main_file") self.assertEqual(len(result), 1) self.assertEqual(result[0].filename, "valhalla.yml") self.assertEqual(result[0].suffix, "") - self.assertEqual(result[0].path, "./resources/test_main_file") + self.assertEqual(result[0].path, "/home/pz2/repo/valhalla/test/version/resources/test_main_file") def test_main_and_hotfix_file(self): - result = get_release_kinds("./resources/test_main_and_hotfix_file") + result = get_release_kinds(os.path.dirname(os.path.abspath(__file__)) + "/resources/test_main_and_hotfix_file") self.assertEqual(len(result), 2) self.assertEqual(result[0].filename, "valhalla.yml") self.assertEqual(result[0].suffix, "") - self.assertEqual(result[0].path, "./resources/test_main_and_hotfix_file") + self.assertEqual(result[0].path, "/home/pz2/repo/valhalla/test/version/resources/test_main_and_hotfix_file") self.assertEqual(result[1].filename, "valhalla-hotfix.yml") self.assertEqual(result[1].suffix, "-hotfix") - self.assertEqual(result[1].path, "./resources/test_main_and_hotfix_file") + self.assertEqual(result[1].path, "/home/pz2/repo/valhalla/test/version/resources/test_main_and_hotfix_file") @patch('valhalla.version.version_to_release.exit') def test_empty(self, mock_exit): - result = get_release_kinds("./resources/empty") + result = get_release_kinds(os.path.dirname(os.path.abspath(__file__)) + "/resources/empty") mock_exit.assert_called_with(-1) diff --git a/valhalla/version/version_to_release.py b/valhalla/version/version_to_release.py index 4f2e248..3e07ce9 100644 --- a/valhalla/version/version_to_release.py +++ b/valhalla/version/version_to_release.py @@ -29,6 +29,8 @@ def get_config_file_path(self): def get_release_kinds(path: str) -> List[ReleaseKind]: info(f"Searching for valhalla*.yml files in: {path}") + info(f"Current pwd: {os.getcwd()}") + pattern = re.compile(r'valhalla(.*)\.yml') release_kinds = []