Coverage for mlos_bench/mlos_bench/tests/util_git_test.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.5.1, created at 2024-05-06 00:35 +0000

1# 

2# Copyright (c) Microsoft Corporation. 

3# Licensed under the MIT License. 

4# 

5""" 

6Unit tests for get_git_info utility function. 

7""" 

8import re 

9 

10from mlos_bench.util import get_git_info 

11 

12 

13def test_get_git_info() -> None: 

14 """ 

15 Check that we can retrieve git info about the current repository correctly. 

16 """ 

17 (git_repo, git_commit, rel_path) = get_git_info(__file__) 

18 assert "mlos" in git_repo.lower() 

19 assert re.match(r"[0-9a-f]{40}", git_commit) is not None 

20 assert rel_path == "mlos_bench/mlos_bench/tests/util_git_test.py"