(ctx context.Context, t *testctx.T)
| 784 | } |
| 785 | |
| 786 | func (PythonSuite) TestUv(ctx context.Context, t *testctx.T) { |
| 787 | t.Run("disabled", func(ctx context.Context, t *testctx.T) { |
| 788 | c := connect(ctx, t) |
| 789 | |
| 790 | ctr, err := daggerCliBase(t, c). |
| 791 | With(pyprojectExtra(nil, ` |
| 792 | [tool.dagger] |
| 793 | use-uv = false |
| 794 | `)). |
| 795 | With(daggerInitPython()). |
| 796 | // Only uv creates a lock |
| 797 | WithExec([]string{"test", "!", "-f", "uv.lock"}). |
| 798 | WithExec([]string{"test", "!", "-f", "requirements.lock"}). |
| 799 | Sync(ctx) |
| 800 | |
| 801 | require.NoError(t, err) |
| 802 | |
| 803 | // Should still work with pip though |
| 804 | out, err := ctr. |
| 805 | With(daggerCall("container-echo", "--string-arg=hello", "stdout")). |
| 806 | Stdout(ctx) |
| 807 | |
| 808 | require.NoError(t, err) |
| 809 | require.Equal(t, "hello\n", out) |
| 810 | }) |
| 811 | |
| 812 | t.Run("disabled, check pip install", func(ctx context.Context, t *testctx.T) { |
| 813 | // `pip check` fails if Requires-Python doesn't match the |
| 814 | // Python version in the container |
| 815 | |
| 816 | c := connect(ctx, t) |
| 817 | |
| 818 | out, err := daggerCliBase(t, c). |
| 819 | With(pyprojectExtra(nil, ` |
| 820 | requires-python = "<3.11" |
| 821 | |
| 822 | [tool.dagger] |
| 823 | use-uv = false |
| 824 | `)). |
| 825 | With(daggerInitPython()). |
| 826 | With(daggerCall("container-echo", "--string-arg=hello", "stdout")). |
| 827 | Stdout(ctx) |
| 828 | |
| 829 | t.Logf("out: %s", out) |
| 830 | requireErrOut(t, err, "pip is looking at multiple versions of test") |
| 831 | requireErrOut(t, err, "requires a different Python") |
| 832 | }) |
| 833 | |
| 834 | t.Run("pinned version", func(ctx context.Context, t *testctx.T) { |
| 835 | c := connect(ctx, t) |
| 836 | |
| 837 | source := pythonSource(` |
| 838 | import anyio |
| 839 | import dagger |
| 840 | |
| 841 | @dagger.object_type |
| 842 | class Test: |
| 843 | @dagger.function |
nothing calls this directly
no test coverage detected