Repository: IAMconsortium/nomenclature

Issue:
Remove the warning of missing model mapping
This causes more harm than good, should be removed.

Discussion:

Patch:
diff --git a/nomenclature/code.py b/nomenclature/code.py
index 097b644..0d7e536 100644
--- a/nomenclature/code.py
+++ b/nomenclature/code.py
@@ -12,6 +12,8 @@ from pydantic import (
     ValidationInfo,
 )
 
+from nomenclature.error import ErrorCollector
+
 from pyam.utils import to_list
 
 from .countries import countries
@@ -259,15 +261,20 @@ class RegionCode(Code):
     @field_validator("iso3_codes")
     def check_iso3_codes(cls, v: List[str], info: ValidationInfo) -> List[str]:
         """Verifies that each ISO3 code is valid according to pycountry library."""
+        errors = ErrorCollector()
         if invalid_iso3_codes := [
             iso3_code
             for iso3_code in to_list(v)
             if countries.get(alpha_3=iso3_code) is None
         ]:
-            raise ValueError(
-                f"Region '{info.data['name']}' has invalid ISO3 country code(s): "
-                + ", ".join(invalid_iso3_codes)
+            errors.append(
+                ValueError(
+                    f"Region '{info.data['name']}' has invalid ISO3 country code(s): "
+                    + ", ".join(invalid_iso3_codes)
+                )
             )
+        if errors:
+            raise ValueError(errors)
         return v
 
 
diff --git a/nomenclature/error.py b/nomenclature/error.py
index 3ae8750..6549a90 100644
--- a/nomenclature/error.py
+++ b/nomenclature/error.py
@@ -39,7 +39,7 @@ pydantic_custom_error_config = {
     ),
     "RegionNotDefinedError": (
         "region_not_defined",
-        "Region(s) {regions} in {file} not found in RegionCodeList",
+        "Region(s)\n{regions}\nin {file}\nnot found in RegionCodeList",
     ),
 }
 
diff --git a/nomenclature/processor/region.py b/nomenclature/processor/region.py
index b0f40a3..a2da27b 100644
--- a/nomenclature/processor/region.py
+++ b/nomenclature/processor/region.py
@@ -550,7 +550,9 @@ class RegionProcessor(Processor):
 
             # if no mapping is defined the data frame is returned unchanged
             if model not in self.mappings:
-                logger.info(f"No model mapping found for model '{model}'")
+                logger.info(
+                    f"Skipping region aggregation for model '{model}' (no region processing mapping)"
+                )
                 processed_dfs.append(model_df)
 
             # otherwise we first rename, then aggregate


Test patch:
diff --git a/tests/test_code.py b/tests/test_code.py
index c228c5e..25380b7 100644
--- a/tests/test_code.py
+++ b/tests/test_code.py
@@ -157,7 +157,8 @@ def test_RegionCode_iso3_code_list_fail():
     error_pattern = (
         "1 validation error for RegionCode\n"
         "iso3_codes\n"
-        "  Value error, Region 'Western Europe' has "
+        "  Value error, Collected 1 error:\n"
+        "  1. Region 'Western Europe' has "
         "invalid ISO3 country code\(s\): DMK, IPL, ATZ, FNL, FRE, DEX, GRE, "  # noqa
         "IBL, ITL, LIC, MLA, BEG, FRT, ANB, GDR, LXB, MNO, NTD, NRW, PRE, EPA, "  # noqa
         "SWD, CEW, GTR, SOR"  # noqa
@@ -170,7 +171,8 @@ def test_RegionCode_iso3_code_str_fail():
     error_pattern = (
         "1 validation error for RegionCode\n"
         "iso3_codes\n"
-        "  Value error, Region 'Austria' has invalid ISO3 country code\(s\): AUTT"
+        "  Value error, Collected 1 error:\n"
+        "  1. Region 'Austria' has invalid ISO3 country code\(s\): AUTT"
     )
     with raises(ValueError, match=error_pattern):
         RegionCode(name="Austria", hierarchy="country", iso3_codes="AUTT")
diff --git a/tests/test_region_aggregation.py b/tests/test_region_aggregation.py
index f10c7d8..bdeea94 100644
--- a/tests/test_region_aggregation.py
+++ b/tests/test_region_aggregation.py
@@ -144,9 +144,9 @@ def test_region_processor_not_defined(simple_definition):
     # definition
     error_msg = (
         "mappings.model_(a|b).*\n"
-        ".*region_a.*mapping_(1|2).yaml.*region_not_defined.*\n"
+        ".*\n.*region_a.*\n.*mapping_(1|2).yaml\n.*region_not_defined.*\n"
         "mappings.model_(a|b).*\n"
-        ".*region_a.*mapping_(1|2).yaml.*region_not_defined"
+        ".*\n.*region_a.*\n.*mapping_(1|2).yaml\n.*region_not_defined"
     )
 
     with pytest.raises(ValueError, match=error_msg):