(ctx context.Context, t *testctx.T)
| 724 | } |
| 725 | |
| 726 | func (PythonSuite) TestAltRuntime(ctx context.Context, t *testctx.T) { |
| 727 | c := connect(ctx, t) |
| 728 | |
| 729 | runtimeSrcPath, err := filepath.Abs("../../sdk/python/runtime") |
| 730 | require.NoError(t, err) |
| 731 | |
| 732 | extSrcPath, err := filepath.Abs("./testdata/modules/python/extended") |
| 733 | require.NoError(t, err) |
| 734 | |
| 735 | moduleSrcPath, err := filepath.Abs("./testdata/modules/python/git-dep") |
| 736 | require.NoError(t, err) |
| 737 | |
| 738 | base := goGitBase(t, c). |
| 739 | WithMountedDirectory("/work/runtime", c.Host().Directory(runtimeSrcPath)). |
| 740 | WithMountedDirectory("/work/extended", c.Host().Directory(extSrcPath)). |
| 741 | WithExec([]string{"sed", "-i", "s#../../../../../sdk/python/##", "/work/extended/dagger.json"}) |
| 742 | |
| 743 | t.Run("git dependency", func(ctx context.Context, t *testctx.T) { |
| 744 | out, err := base. |
| 745 | WithMountedDirectory("/work/git-dep", c.Host().Directory(moduleSrcPath)). |
| 746 | WithWorkdir("/work/git-dep"). |
| 747 | With(daggerCall("hello")). |
| 748 | Stdout(ctx) |
| 749 | |
| 750 | require.NoError(t, err) |
| 751 | require.Contains(t, out, "git version") |
| 752 | }) |
| 753 | |
| 754 | t.Run("disabled custom config", func(ctx context.Context, t *testctx.T) { |
| 755 | out, err := base. |
| 756 | WithWorkdir("/work/test"). |
| 757 | With(pyprojectExtra(nil, ` |
| 758 | requires-python = ">=3.11" |
| 759 | |
| 760 | [tool.dagger] |
| 761 | use-uv = false |
| 762 | `)). |
| 763 | With(pythonSource(` |
| 764 | import sys |
| 765 | import dagger |
| 766 | |
| 767 | @dagger.object_type |
| 768 | class Test: |
| 769 | @dagger.function |
| 770 | def version(self) -> str: |
| 771 | v = sys.version_info |
| 772 | return f"{v.major}.{v.minor}" |
| 773 | `, |
| 774 | )). |
| 775 | With(daggerExec("init", "--sdk=../extended", "--name=test", "--source=.")). |
| 776 | // use-uv = false should be ignored |
| 777 | WithExec([]string{"test", "-f", "uv.lock"}). |
| 778 | With(daggerCall("version")). |
| 779 | Stdout(ctx) |
| 780 | |
| 781 | require.NoError(t, err) |
| 782 | require.Equal(t, "3.14", out) |
| 783 | }) |
nothing calls this directly
no test coverage detected