(t *testing.T)
| 490 | return fakePython |
| 491 | } |
| 492 | |
| 493 | func 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: ` |
| 511 | exec_prefix = "/opt/python3.11" |
| 512 | installed_base = "/layers/google.python.runtime/python" |
| 513 | `, |
| 514 | want: "/opt/python3.11", |
| 515 | }, |
| 516 | { |
| 517 | sysConfig: ` |
| 518 | exec_prefix = "/opt/python3.9" |
| 519 | installed_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 | |
| 537 | func TestAdaptEntrypoint(t *testing.T) { |
nothing calls this directly
no test coverage detected