MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/buildpacks / TestParseExecPrefix

Function TestParseExecPrefix

pkg/python/python_test.go:492–534  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

490 return fakePython
491}
492
493func TestParseExecPrefix(t *testing.T) {
494 testCases := []struct {
495 sysConfig string
496 want string
497 wantErr bool
498 }{
499 {
500 sysConfig: "",
501 want: "",
502 wantErr: true,
503 },
504 {
505 sysConfig: `installed_base = "/layers/google.python.runtime/python"`,
506 want: "",
507 wantErr: true,
508 },
509 {
510 sysConfig: `
511exec_prefix = "/opt/python3.11"
512installed_base = "/layers/google.python.runtime/python"
513 `,
514 want: "/opt/python3.11",
515 },
516 {
517 sysConfig: `
518exec_prefix = "/opt/python3.9"
519installed_base = "/layers/google.python.runtime/python"
520 `,
521 want: "/opt/python3.9",
522 },
523 }
524 for _, tc := range testCases {
525 t.Run(tc.sysConfig, func(t *testing.T) {
526 got, err := parseExecPrefix(tc.sysConfig)
527 if (err == nil) == tc.wantErr {
528 t.Errorf("parseExecPrefix() got err: %v, want %v", err, tc.wantErr)
529 }
530 if got != tc.want {
531 t.Errorf("parseExecPrefix(%q) = %q, want %q", tc.sysConfig, got, tc.want)
532 }
533 })
534 }
535}
536
537func TestAdaptEntrypoint(t *testing.T) {

Callers

nothing calls this directly

Calls 1

parseExecPrefixFunction · 0.85

Tested by

no test coverage detected