def test_vet_local_deps_abspath(platform_specific_path): dependencies = [{"name": "foo", "version": platform_specific_path}] expect_error = re.escape( f"Absolute paths to gomod dependencies are not supported: {platform_specific_path}" ) with pytest.raises(CachitoError, match=expect_error): _vet_local_deps(dependencies, "some-module", [])
def test_vet_local_deps_parent_dir(path): dependencies = [{"name": "foo", "version": path}] expect_error = re.escape( f"Path to gomod dependency contains '..': {path}. Cachito does not support this case." ) with pytest.raises(CachitoError, match=expect_error): _vet_local_deps(dependencies, "some-module", [])
def test_vet_local_deps(mock_fail_allowlist): dependencies = [ {"name": "foo", "version": "./local/foo"}, {"name": "bar", "version": "v1.0.0"}, {"name": "baz", "version": "./local/baz"}, ] module_name = "some-module" _vet_local_deps(dependencies, module_name, ["foo", "baz"]) mock_fail_allowlist.assert_has_calls( [ mock.call("some-module", "foo", ["foo", "baz"]), mock.call("some-module", "baz", ["foo", "baz"]), ], )