nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: SFDO-Tooling/CumulusCI
Pull request #3817 (2024-08-19 10:46:53)

Fix the required fields error for the Upsert action 
Suppress the required field check for the upsert action at mappingstep


Patch:
diff --git a/cumulusci/tasks/bulkdata/mapping_parser.py b/cumulusci/tasks/bulkdata/mapping_parser.py
index 3e6aa2854..bb59fc664 100644
--- a/cumulusci/tasks/bulkdata/mapping_parser.py
+++ b/cumulusci/tasks/bulkdata/mapping_parser.py
@@ -554,9 +554,8 @@ class MappingStep(CCIDictModel):
         )
 
         if is_load:
-            required_fields_correct = self.check_required(describe)
-            if not required_fields_correct:
-                return False
+            # Show warning logs for unspecified required fields
+            self.check_required(describe)
 
         if not (fields_correct and lookups_correct):
             return False


Test patch:
diff --git a/cumulusci/tasks/bulkdata/tests/test_mapping_parser.py b/cumulusci/tasks/bulkdata/tests/test_mapping_parser.py
index 1ad447697..c1419f300 100644
--- a/cumulusci/tasks/bulkdata/tests/test_mapping_parser.py
+++ b/cumulusci/tasks/bulkdata/tests/test_mapping_parser.py
@@ -1104,7 +1104,10 @@ class TestMappingParser:
             )
 
     @responses.activate
-    def test_validate_and_inject_mapping_throws_exception_required_fields_missing(self):
+    def test_validate_and_inject_mapping_throws_exception_required_fields_missing(
+        self, caplog
+    ):
+        caplog.set_level(logging.ERROR)
         mock_describe_calls()
         mapping = parse_from_yaml(
             StringIO(
@@ -1117,15 +1120,22 @@ class TestMappingParser:
             {"instance_url": "https://example.com", "access_token": "abc123"}, "test"
         )
 
-        with pytest.raises(BulkDataException):
-            validate_and_inject_mapping(
-                mapping=mapping,
-                sf=org_config.salesforce_client,
-                namespace=None,
-                data_operation=DataOperationType.INSERT,
-                inject_namespaces=False,
-                drop_missing=False,
-            )
+        validate_and_inject_mapping(
+            mapping=mapping,
+            sf=org_config.salesforce_client,
+            namespace="",
+            data_operation=DataOperationType.INSERT,
+            inject_namespaces=False,
+            drop_missing=False,
+        )
+
+        expected_error_message = (
+            "One or more required fields are missing for loading on Account :{'Name'}"
+        )
+        error_logs = [
+            record.message for record in caplog.records if record.levelname == "ERROR"
+        ]
+        assert any(expected_error_message in error_log for error_log in error_logs)
 
     @responses.activate
     def test_validate_and_inject_mapping_injects_namespaces(self):
Repository: SFDO-Tooling/CumulusCI
Pull request #3465 (2022-12-13 01:13:08)

Test that migration from pickle to JSON works
Put back in the O_TRUNC fix and ensure that it works.


Patch:
diff --git a/cumulusci/core/keychain/encrypted_file_project_keychain.py b/cumulusci/core/keychain/encrypted_file_project_keychain.py
index eb213af7f..58167b49e 100644
--- a/cumulusci/core/keychain/encrypted_file_project_keychain.py
+++ b/cumulusci/core/keychain/encrypted_file_project_keychain.py
@@ -32,7 +32,7 @@ DEFAULT_SERVICES_FILENAME = "DEFAULT_SERVICES.json"
 # The file permissions that we want set on all
 # .org and .service files. Equivalent to -rw-------
 SERVICE_ORG_FILE_MODE = 0o600
-OS_FILE_FLAGS = os.O_WRONLY | os.O_CREAT
+OS_FILE_FLAGS = os.O_WRONLY | os.O_CREAT | os.O_TRUNC
 if sys.platform.startswith("win"):
     # O_BINARY only available on Windows
     OS_FILE_FLAGS |= os.O_BINARY


Test patch:
diff --git a/cumulusci/core/keychain/tests/test_encrypted_file_project_keychain.py b/cumulusci/core/keychain/tests/test_encrypted_file_project_keychain.py
index 9c2caf3b5..4366077d1 100644
--- a/cumulusci/core/keychain/tests/test_encrypted_file_project_keychain.py
+++ b/cumulusci/core/keychain/tests/test_encrypted_file_project_keychain.py
@@ -1151,3 +1151,30 @@ class TestCleanupOrgCacheDir:
         }
         assert config["custom_datetime"] == custom_datetime
         assert config["custom_date"] == custom_date
+
+    def test_migration_pickle_to_json(
+        self, keychain, patch_home_and_env, project_config
+    ):
+        # This all runs in fake-home, not real home.
+        with mock.patch(
+            "cumulusci.core.keychain.serialization.SHOULD_SAVE_AS_JSON", False
+        ):
+            org_config = OrgConfig(
+                {"password": "Kltpzyxm"}, "test_migration", keychain=keychain
+            )
+            org_config.save()
+            assert Path(keychain.project_local_dir, "test_migration.org").exists()
+            del keychain.config["orgs"]
+            keychain._load_orgs()
+            assert keychain.get_org("test_migration").password == "Kltpzyxm"
+            assert keychain.get_org("test_migration").serialization_format == "pickle"
+
+        with mock.patch(
+            "cumulusci.core.keychain.serialization.SHOULD_SAVE_AS_JSON", True
+        ):
+            org_config.save()
+            assert Path(keychain.project_local_dir, "test_migration.org").exists()
+            del keychain.config["orgs"]
+            keychain._load_orgs()
+            assert keychain.get_org("test_migration").password == "Kltpzyxm"
+            assert keychain.get_org("test_migration").serialization_format == "json"
Repository: sktime/sktime
Pull request #7952 (2025-03-08 08:34:05)

[ENH] test parameter estimator `update` in suite tests
This PR adds test suite coverage for the `update` method of parameter fitters.

This PR also fixes some bugs uncovered by adding the tests.

fkiraly: faillure on main, quick merge

Patch:
diff --git a/sktime/param_est/base.py b/sktime/param_est/base.py
index dcc888fc9..d50343fd2 100644
--- a/sktime/param_est/base.py
+++ b/sktime/param_est/base.py
@@ -299,7 +299,7 @@ class BaseParamFitter(BaseEstimator):
         X_inner, y_inner = self._check_X_y(X=X, y=y)
 
         # update internal X, y with the new X, y
-        self._update_y_X(y_inner, X_inner)
+        self._update_X_y(X_inner, y_inner)
 
         # checks and conversions complete, pass to inner update
         _safe_call(self._update, args=(), kwargs={"X": X_inner, "y": y_inner})


Test patch:
diff --git a/sktime/param_est/tests/test_all_param_est.py b/sktime/param_est/tests/test_all_param_est.py
index 78afbcec3..7906f93d8 100644
--- a/sktime/param_est/tests/test_all_param_est.py
+++ b/sktime/param_est/tests/test_all_param_est.py
@@ -4,6 +4,7 @@
 __author__ = ["fkiraly"]
 
 from sktime.tests.test_all_estimators import BaseFixtureGenerator, QuickTester
+from sktime.utils._testing.forecasting import _make_series
 
 
 class ParamFitterFixtureGenerator(BaseFixtureGenerator):
@@ -37,3 +38,25 @@ class TestAllParamFitters(ParamFitterFixtureGenerator, QuickTester):
 
         # there should be at least one parameter fitted
         assert len(gfp_ret) > 0
+
+    def test_update(self, estimator_instance):
+        """Test that update works as expected."""
+        X = _make_series(n_timepoints=100, return_mtype="pd.DataFrame")
+        X1 = X.iloc[:80]
+        X2 = X.iloc[80:90]
+        X3 = X.iloc[90:]
+
+        estimator_instance.fit(X1)
+
+        gfp_ret = estimator_instance.get_fitted_params()
+        assert isinstance(gfp_ret, dict)
+
+        estimator_instance.update(X2)
+
+        gfp_ret = estimator_instance.get_fitted_params()
+        assert isinstance(gfp_ret, dict)
+
+        estimator_instance.update(X3)
+
+        gfp_ret = estimator_instance.get_fitted_params()
+        assert isinstance(gfp_ret, dict)