Repository: SFDO-Tooling/CumulusCI
Pull request #3030 (2022-01-07 23:48:13)

Add backwards-compatible files and warnings for OrgConfig rename
Nothing for release notes:

Make backwards compatible shims for OrgConfig stuff.


Patch:
diff --git a/cumulusci/core/config/BaseConfig.py b/cumulusci/core/config/BaseConfig.py
new file mode 100644
index 000000000..b186936c0
--- /dev/null
+++ b/cumulusci/core/config/BaseConfig.py
@@ -0,0 +1,5 @@
+from warnings import warn
+
+from .base_config import *  # noqa
+
+warn("Deprecation warning: Please import from .base_config rather than .BaseConfig")
diff --git a/cumulusci/core/config/BaseTaskFlowConfig.py b/cumulusci/core/config/BaseTaskFlowConfig.py
new file mode 100644
index 000000000..3253205f8
--- /dev/null
+++ b/cumulusci/core/config/BaseTaskFlowConfig.py
@@ -0,0 +1,7 @@
+from warnings import warn
+
+from .base_task_flow_config import *  # noqa
+
+warn(
+    "Deprecation warning: Please import from .base_task_flow_config rather than .BaseTaskFlowConfig"
+)
diff --git a/cumulusci/core/config/OrgConfig.py b/cumulusci/core/config/OrgConfig.py
new file mode 100644
index 000000000..dba71a58c
--- /dev/null
+++ b/cumulusci/core/config/OrgConfig.py
@@ -0,0 +1,5 @@
+from warnings import warn
+
+from .org_config import *  # noqa
+
+warn("Deprecation warning: Please import from .org_config rather than .OrgConfig")
diff --git a/cumulusci/core/config/ScratchOrgConfig.py b/cumulusci/core/config/ScratchOrgConfig.py
new file mode 100644
index 000000000..b8f28bf7c
--- /dev/null
+++ b/cumulusci/core/config/ScratchOrgConfig.py
@@ -0,0 +1,7 @@
+from warnings import warn
+
+from .scratch_org_config import *  # noqa
+
+warn(
+    "Deprecation warning: Please import from .scratch_org_config rather than .ScratchOrgConfig"
+)


Test patch:
diff --git a/cumulusci/core/config/tests/_test_config_backwards_compatibility.py b/cumulusci/core/config/tests/_test_config_backwards_compatibility.py
new file mode 100644
index 000000000..24a8269c9
--- /dev/null
+++ b/cumulusci/core/config/tests/_test_config_backwards_compatibility.py
@@ -0,0 +1,24 @@
+import pytest
+
+
+class TestConfigBackwardsCompatibility:
+    def test_temporary_backwards_compatiblity_hacks(self):
+        with pytest.warns(UserWarning):
+            from cumulusci.core.config.OrgConfig import OrgConfig
+
+            assert isinstance(OrgConfig, type)
+
+        with pytest.warns(UserWarning):
+            from cumulusci.core.config.ScratchOrgConfig import ScratchOrgConfig  # noqa
+
+            assert isinstance(ScratchOrgConfig, type)
+
+        with pytest.warns(UserWarning):
+            from cumulusci.core.config.BaseConfig import BaseConfig
+
+            assert isinstance(BaseConfig, type)
+
+        with pytest.warns(UserWarning):
+            from cumulusci.core.config.BaseTaskFlowConfig import BaseTaskFlowConfig
+
+            assert isinstance(BaseTaskFlowConfig, type)
diff --git a/cumulusci/core/config/tests/test_config_expensive.py b/cumulusci/core/config/tests/test_config_expensive.py
index a511b128e..0b6f566ba 100644
--- a/cumulusci/core/config/tests/test_config_expensive.py
+++ b/cumulusci/core/config/tests/test_config_expensive.py
@@ -795,3 +795,9 @@ class TestScratchOrgConfigPytest:
             args = config._build_org_create_args()
 
         assert "adminEmail=test@example.com" not in args
+
+    def test_temporary_backwards_compatiblity_hacks(self):
+        filename = Path(__file__).parent / "_test_config_backwards_compatibility.py"
+        # run this in a separate process to not confuse
+        # the module table
+        assert os.system(f"pytest {filename}") == 0