Skip to content

Commit 043ffc2

Browse files
Claudeilaflott
andauthored
Add test for git clone with --branch tag specified
Add test_fetch_tables_git_with_tag to verify that _fetch_tables_git correctly uses the --branch flag when a tag is specified. This ensures git clone can checkout a specific release tag (e.g., 6.9.33). Agent-Logs-Url: https://github.com/ilaflott/fremorizer/sessions/b249a7f2-8f08-487e-8b8a-60dfba117869 Co-authored-by: ilaflott <6273252+ilaflott@users.noreply.github.com>
1 parent cae0423 commit 043ffc2

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

fremorizer/tests/test_cmor_init_subtool.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,25 @@ def test_fetch_tables_curl_with_tag(tmp_path):
216216
assert tables_dir.exists()
217217
json_files = list(tables_dir.rglob('*.json'))
218218
assert len(json_files) > 0
219+
220+
221+
def test_fetch_tables_git_with_tag(tmp_path):
222+
'''Test fetching tables with a specific git tag using git clone.
223+
224+
This verifies that the --branch tag parameter works correctly.
225+
Uses a known tag from the CMIP6 repository (6.9.33).
226+
'''
227+
tables_dir = tmp_path / 'tables_git_with_tag'
228+
repo_url = MIP_TABLE_REPOS['cmip6']
229+
230+
# Use a known release tag from the repository
231+
# Tags follow pattern like '6.9.33', not 'v6.9.33'
232+
_fetch_tables_git(repo_url, str(tables_dir), tag='6.9.33')
233+
234+
# Verify directory exists and has .git
235+
assert tables_dir.exists()
236+
assert (tables_dir / '.git').exists(), 'Git directory not found'
237+
238+
# Verify content was cloned
239+
json_files = list(tables_dir.rglob('*.json'))
240+
assert len(json_files) > 0, 'No JSON files found in cloned repository'

0 commit comments

Comments
 (0)