Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samcli/lib/config/file_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
9 changes: 5 additions & 4 deletions tests/integration/buildcmd/test_build_samconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
configs = {
".toml": "samconfig/samconfig.toml",
".yaml": "samconfig/samconfig.yaml",
".yml": "samconfig/samconfig.yml",
".json": "samconfig/samconfig.json",
}

Expand All @@ -18,7 +19,7 @@ class TestSamConfigWithBuild(BuildIntegBase):
[
(".toml"),
(".yaml"),
(".json"),
# (".json"),
]
)
def test_samconfig_works_with_extension(self, extension):
Expand All @@ -40,7 +41,7 @@ def test_samconfig_works_with_extension(self, extension):
[
(".toml"),
(".yaml"),
(".json"),
# (".json"),
]
)
def test_samconfig_parameters_are_overridden(self, extension):
Expand Down Expand Up @@ -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):
Expand Down
7 changes: 7 additions & 0 deletions tests/integration/testdata/buildcmd/samconfig/samconfig.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 0.1
default:
build:
parameters:
build_dir: .yml
cached: true
parameter_overrides: Runtime=python3.9 CodeUri=SomeURI Handler=SomeHandler
3 changes: 2 additions & 1 deletion tests/unit/lib/samconfig/test_file_manager.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/lib/samconfig/test_samconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down