Skip to content

Commit

Permalink
Added release kinds to allow creating many valhalla.yml files to defi…
Browse files Browse the repository at this point in the history
…ne different processes
  • Loading branch information
pz2 committed May 18, 2024
1 parent 02d3fdc commit c57f891
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions test/version/version_to_release_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,31 @@
class GetValhallaReleaseKindsTest(unittest.TestCase):

def test_main_file(self):
result = get_release_kinds(os.path.dirname(os.path.abspath(__file__)) + "/resources/test_main_file")
path = os.path.dirname(os.path.abspath(__file__)) + "/resources/test_main_file"
result = get_release_kinds(path)

self.assertEqual(len(result), 1)

self.assertEqual(result[0].filename, "valhalla.yml")
self.assertEqual(result[0].suffix, "")
self.assertEqual(result[0].path, "/home/pz2/repo/valhalla/test/version/resources/test_main_file")
self.assertEqual(result[0].path, path)

def test_main_and_hotfix_file(self):
result = get_release_kinds(os.path.dirname(os.path.abspath(__file__)) + "/resources/test_main_and_hotfix_file")
path = os.path.dirname(os.path.abspath(__file__)) + "/resources/test_main_and_hotfix_file"
result = get_release_kinds(path)

self.assertEqual(len(result), 2)

self.assertEqual(result[0].filename, "valhalla.yml")
self.assertEqual(result[0].suffix, "")
self.assertEqual(result[0].path, "/home/pz2/repo/valhalla/test/version/resources/test_main_and_hotfix_file")
self.assertEqual(result[0].path, path)

self.assertEqual(result[1].filename, "valhalla-hotfix.yml")
self.assertEqual(result[1].suffix, "-hotfix")
self.assertEqual(result[1].path, "/home/pz2/repo/valhalla/test/version/resources/test_main_and_hotfix_file")
self.assertEqual(result[1].path, path)

@patch('valhalla.version.version_to_release.exit')
def test_empty(self, mock_exit):
result = get_release_kinds(os.path.dirname(os.path.abspath(__file__)) + "/resources/empty")
path = os.path.dirname(os.path.abspath(__file__)) + "/resources/empty"
result = get_release_kinds(path)
mock_exit.assert_called_with(-1)

0 comments on commit c57f891

Please sign in to comment.