diff --git a/tests/unit/cli/vyper_json/test_get_inputs.py b/tests/unit/cli/vyper_json/test_get_inputs.py index c91cc750f2..7a6901bfd1 100644 --- a/tests/unit/cli/vyper_json/test_get_inputs.py +++ b/tests/unit/cli/vyper_json/test_get_inputs.py @@ -92,8 +92,8 @@ def test_interface_collision(): "sources": {"foo.vy": {"content": FOO_CODE}}, "interfaces": {"bar.json": {"abi": BAR_ABI}, "bar.vy": {"content": BAR_CODE}}, } - with pytest.raises(JSONError): - get_inputs(input_json) + # don't throw, bar.json and bar.vy have different paths + get_inputs(input_json) def test_json_no_abi(): diff --git a/vyper/cli/vyper_json.py b/vyper/cli/vyper_json.py index 750afcb88e..cc3e2ce3fc 100755 --- a/vyper/cli/vyper_json.py +++ b/vyper/cli/vyper_json.py @@ -160,7 +160,8 @@ def get_inputs(input_dict: dict) -> dict[PurePath, Any]: seen = {} for path, value in input_dict["sources"].items(): - path = PurePath(path) + path = PurePath(_normpath(path)) + if "urls" in value: raise JSONError(f"{path} - 'urls' is not a supported field, use 'content' instead") if "content" not in value: @@ -171,17 +172,17 @@ def get_inputs(input_dict: dict) -> dict[PurePath, Any]: raise JSONError( f"Calculated keccak of '{path}' does not match keccak given in input JSON" ) - if path.stem in seen: + if path in seen: raise JSONError(f"Contract namespace collision: {path}") # value looks like {"content": } # this will be interpreted by JSONInputBundle later ret[path] = value - seen[path.stem] = True + seen[path] = True for path, value in input_dict.get("interfaces", {}).items(): - path = PurePath(path) - if path.stem in seen: + path = PurePath(_normpath(path)) + if path in seen: raise JSONError(f"Interface namespace collision: {path}") if isinstance(value, list): @@ -208,7 +209,7 @@ def get_inputs(input_dict: dict) -> dict[PurePath, Any]: ) ret[path] = value - seen[path.stem] = True + seen[path] = True return ret