fremor.tests.test_cmor_init_subtool module

Unit tests for cmor_init module

Tests the cmor_init_subtool and its helper functions including: - _fetch_tables_git: git clone table fetching - _fetch_tables_curl: curl tarball table fetching - cmor_init_subtool: main initialization logic - ValueError handling for invalid mip_era

fremor.tests.test_cmor_init_subtool.test_cmor_init_invalid_mip_era()

Test that invalid mip_era raises ValueError

fremor.tests.test_cmor_init_subtool.test_cmor_init_tables_dir_and_exp_config(tmp_path)

Test that both exp_config and tables_dir can be provided together.

fremor.tests.test_cmor_init_subtool.test_cmor_init_tables_dir_only_no_exp_config(tmp_path)

Test that when only tables_dir is provided, no exp_config is created.

fremor.tests.test_cmor_init_subtool.test_cmor_init_tables_dir_with_curl(tmp_path)

Test fetching tables with curl (fast mode) when tables_dir is provided.

This test actually fetches the CMIP6 tables from GitHub using curl, without mocking, to ensure the full integration works.

fremor.tests.test_cmor_init_subtool.test_cmor_init_tables_dir_with_git(tmp_path)

Test fetching tables with git clone when tables_dir is provided.

This test actually clones the CMIP7 tables from GitHub using git, without mocking, to ensure the full integration works.

fremor.tests.test_cmor_init_subtool.test_fetch_tables_curl_directly(tmp_path)

Test _fetch_tables_curl function directly.

This test exercises the curl + tarball extraction functionality without mocking, using the actual CMIP7 repository.

fremor.tests.test_cmor_init_subtool.test_fetch_tables_curl_with_tag(tmp_path)

Test fetching tables with a specific git tag using curl.

This verifies that the tag parameter works correctly. Uses a known tag from the CMIP6 repository (6.9.33).

fremor.tests.test_cmor_init_subtool.test_fetch_tables_git_directly(tmp_path)

Test _fetch_tables_git function directly.

This test exercises the git clone functionality without mocking, using a small repository to keep the test fast.

fremor.tests.test_cmor_init_subtool.test_fetch_tables_git_with_tag(tmp_path)

Test fetching tables with a specific git tag using git clone.

This verifies that the –branch tag parameter works correctly. Uses a known tag from the CMIP6 repository (6.9.33).