diff --git a/samcli/lib/config/file_manager.py b/samcli/lib/config/file_manager.py index 43f2609e4d..0629ace318 100644 --- a/samcli/lib/config/file_manager.py +++ b/samcli/lib/config/file_manager.py @@ -338,5 +338,5 @@ def put_comment(document: Any, comment: str) -> Any: ".toml": TomlFileManager, ".yaml": YamlFileManager, ".yml": YamlFileManager, - ".json": JsonFileManager, + # ".json": JsonFileManager, # JSON support disabled } diff --git a/tests/integration/buildcmd/test_build_samconfig.py b/tests/integration/buildcmd/test_build_samconfig.py index bdfd87762b..3df5052599 100644 --- a/tests/integration/buildcmd/test_build_samconfig.py +++ b/tests/integration/buildcmd/test_build_samconfig.py @@ -9,6 +9,7 @@ configs = { ".toml": "samconfig/samconfig.toml", ".yaml": "samconfig/samconfig.yaml", + ".yml": "samconfig/samconfig.yml", ".json": "samconfig/samconfig.json", } @@ -18,7 +19,7 @@ class TestSamConfigWithBuild(BuildIntegBase): [ (".toml"), (".yaml"), - (".json"), + # (".json"), ] ) def test_samconfig_works_with_extension(self, extension): @@ -40,7 +41,7 @@ def test_samconfig_works_with_extension(self, extension): [ (".toml"), (".yaml"), - (".json"), + # (".json"), ] ) def test_samconfig_parameters_are_overridden(self, extension): @@ -72,8 +73,8 @@ def test_samconfig_parameters_are_overridden(self, extension): @parameterized_class( [ # Ordered by expected priority - {"extensions": [".toml", ".yaml", ".json"]}, - {"extensions": [".yaml", ".json"]}, + {"extensions": [".toml", ".yaml", ".yml"]}, + {"extensions": [".yaml", ".yml"]}, ] ) class TestSamConfigExtensionHierarchy(BuildIntegBase): diff --git a/tests/integration/testdata/buildcmd/samconfig/samconfig.yml b/tests/integration/testdata/buildcmd/samconfig/samconfig.yml new file mode 100644 index 0000000000..4af8baa434 --- /dev/null +++ b/tests/integration/testdata/buildcmd/samconfig/samconfig.yml @@ -0,0 +1,7 @@ +version: 0.1 +default: + build: + parameters: + build_dir: .yml + cached: true + parameter_overrides: Runtime=python3.9 CodeUri=SomeURI Handler=SomeHandler \ No newline at end of file diff --git a/tests/unit/lib/samconfig/test_file_manager.py b/tests/unit/lib/samconfig/test_file_manager.py index eb9325fc37..3b5ddce96c 100644 --- a/tests/unit/lib/samconfig/test_file_manager.py +++ b/tests/unit/lib/samconfig/test_file_manager.py @@ -1,7 +1,7 @@ import json from pathlib import Path import tempfile -from unittest import TestCase +from unittest import TestCase, skip import tomlkit from ruamel.yaml import YAML @@ -182,6 +182,7 @@ def test_yaml_put_comment(self): self.assertIn("# This is a comment", txt) +@skip("JSON config support disabled") class TestJsonFileManager(TestCase): def test_read_json(self): config_dir = tempfile.gettempdir() diff --git a/tests/unit/lib/samconfig/test_samconfig.py b/tests/unit/lib/samconfig/test_samconfig.py index df8ceef80b..c58f0709a6 100644 --- a/tests/unit/lib/samconfig/test_samconfig.py +++ b/tests/unit/lib/samconfig/test_samconfig.py @@ -295,7 +295,7 @@ def test_file_manager_unsupported(self): ("samconfig.toml", TomlFileManager, ".toml"), ("samconfig.yaml", YamlFileManager, ".yaml"), ("samconfig.yml", YamlFileManager, ".yml"), - ("samconfig.json", JsonFileManager, ".json"), + # ("samconfig.json", JsonFileManager, ".json"), ] ) @patch("samcli.lib.telemetry.event.EventTracker.track_event")