diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ec0872350..e0ea6ca88 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -20,3 +20,11 @@ updates: - RobertCraigie rebase-strategy: auto target-branch: main + - package-ecosystem: pip + directory: /pipelines/requirements/ + schedule: + interval: daily + reviewers: + - RobertCraigie + rebase-strategy: auto + target-branch: main diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ab9d9dc66..0072c04b7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,8 +10,6 @@ on: - "LICENSE" - "mkdocs.yml" pull_request: - branches: - - main paths-ignore: - "*.md" - ".vscode/**" @@ -256,11 +254,14 @@ jobs: strategy: fail-fast: false matrix: - docker-platform: ["linux/amd64"] + docker-platform: [linux/amd64] # TODO: Uncomment this to add testing support for arm64 and delete # the above # docker-platform: ["linux/amd64", "linux/arm64"] - python-os-distro: ["slim-bullseye", "alpine"] + # TODO: Uncomment this later, Go-based CLI does not run on Alpine + # https://github.com/prisma/prisma-client-go/issues/357 + # python-os-distro: [slim-bullseye, alpine] + python-os-distro: [slim-bullseye] steps: - uses: actions/checkout@v3 # https://github.com/docker/build-push-action/ @@ -276,14 +277,21 @@ jobs: context: . file: tests/Dockerfile platforms: "${{ matrix.docker-platform }}" - build-args: "${{ matrix.python-os-distro }}" + build-args: OS_DISTRO=${{ matrix.python-os-distro }} + cache-from: type=gha + cache-to: type=gha,mode=max + # Note: Windows does not play well with the standard GH Docker + buildx + # actions docker-windows: name: docker (windows) runs-on: windows-latest steps: - uses: actions/checkout@v3 - - name: Docker Build + # Use --% to allow double hyphen + # Caching not currently working since we don't use buildx yet, windows + # support seems poor because of interactions with --prvileged + # --cache-from=type=gha --cache-to=type=gha,mode=max run: | - docker build -f tests/windows.Dockerfile -t prisma-client-py . + docker build --% -f tests/windows.Dockerfile -t prisma-client-py . diff --git a/pipelines/requirements/lint.txt b/pipelines/requirements/lint.txt index 3fd7b44ee..fc203b781 100644 --- a/pipelines/requirements/lint.txt +++ b/pipelines/requirements/lint.txt @@ -3,4 +3,4 @@ interrogate==1.5.0 blue==0.9.1 mypy==0.950 -slotscheck==0.14.0 +slotscheck==0.15.0 diff --git a/pipelines/requirements/test.txt b/pipelines/requirements/test.txt index 9a059b279..e956c849f 100644 --- a/pipelines/requirements/test.txt +++ b/pipelines/requirements/test.txt @@ -5,5 +5,5 @@ mock==4.0.3 pytest-mock==3.6.1 pytest-asyncio==0.17.0 pytest-subprocess==1.1.2 -syrupy==1.5.0 +syrupy==3.0.2 fastapi==0.73.0 diff --git a/requirements/docs.txt b/requirements/docs.txt index 78d9fffa9..20392fbc7 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -1,2 +1,2 @@ -mkdocs==1.4.0 -mkdocs-material==8.5.6 +mkdocs==1.4.1 +mkdocs-material==8.5.7 diff --git a/src/prisma/cli/_node.py b/src/prisma/cli/_node.py index f693c452b..d62ab698e 100644 --- a/src/prisma/cli/_node.py +++ b/src/prisma/cli/_node.py @@ -13,6 +13,7 @@ from pydantic.typing import get_args from .. import config +from ..utils import DEBUG from .._proxy import LazyProxy from ..binaries import platform from ..errors import PrismaError @@ -152,6 +153,11 @@ def from_nodeenv(cls, target: Target) -> NodeBinaryStrategy: path, ) else: + nodeenv_args = ( + ['--verbose', *config.nodeenv_extra_args] + if DEBUG + else config.nodeenv_extra_args + ) log.debug('Installing nodeenv to %s', path) subprocess.run( [ @@ -159,7 +165,7 @@ def from_nodeenv(cls, target: Target) -> NodeBinaryStrategy: '-m', 'nodeenv', str(path), - *config.nodeenv_extra_args, + *nodeenv_args, ], check=True, stdout=sys.stdout, diff --git a/src/prisma/mypy.py b/src/prisma/mypy.py index 8da5c6ee4..97d1d174f 100644 --- a/src/prisma/mypy.py +++ b/src/prisma/mypy.py @@ -30,7 +30,6 @@ NameExpr, Var, BytesExpr, - UnicodeExpr, CallExpr, IntExpr, Context, @@ -362,7 +361,7 @@ def _callexpr_to_dict( return parsed def _resolve_expression(self, expression: Expression) -> Any: - if isinstance(expression, (StrExpr, BytesExpr, UnicodeExpr, IntExpr)): + if isinstance(expression, (StrExpr, BytesExpr, IntExpr)): return expression.value if isinstance(expression, NameExpr): diff --git a/tests/Dockerfile b/tests/Dockerfile index 214409c85..40a95e186 100644 --- a/tests/Dockerfile +++ b/tests/Dockerfile @@ -6,7 +6,41 @@ ARG OS_DISTRO=slim-bullseye FROM python:${PYTHON_VERSION}-${OS_DISTRO} -RUN useradd --create-home --uid 9999 --shell /bin/bash prisma +# These are are own build args recorded as env variables +ARG OS_DISTRO +ENV OS_DISTRO=${OS_DISTRO} +ENV PRISMA_USER_ID=9999 + +# These are provided by Docker +ARG BUILDPLATFORM +ARG BUILDOS +ARG BUILDARCH +ARG BUILDVARIANT +ARG TARGETPLATFORM +ARG TARGETOS +ARG TARGETARCH + +ENV DOCKER_BUILDPLATFORM=${BUILDPLATFORM} +ENV DOCKER_BUILDOS=${BUILDOS} +ENV DOCKER_BUILDARCH=${BUILDARCH} +ENV DOCKER_BUILDVARIANT=${BUILDVARIANT} +ENV DOCKER_TARGETPLATFORM=${TARGETPLATFORM} +ENV DOCKER_TARGETOS=${TARGETOS} +ENV DOCKER_TARGETARCH=${TARGETARCH} + +# TODO: Using the slim variant is a bit hackier. Better to +# cat and grep /etc/*release*. Also, the [[ ]] command +# is a bash thing so thats why we subshell for the test +RUN \ + if [[ $OS_DISTRO =~ alpine ]]; then \ + adduser -u ${PRISMA_USER_ID} -D prisma; \ + apk add gcc musl-dev yaml-dev yaml libffi-dev; \ + elif bash -c "[[ ${OS_DISTRO} =~ slim ]]"; then \ + useradd --create-home --uid ${PRISMA_USER_ID} --shell /bin/bash prisma; \ + else \ + echo "Unrecognized distro $OS_DISTRO"; \ + exit 99; \ + fi USER prisma WORKDIR /home/prisma/prisma-client-py @@ -14,7 +48,8 @@ ENV PATH="/home/prisma/.local/bin:${PATH}" COPY --chown=prisma:prisma . . -RUN pip install .[dev] +RUN pip install --upgrade pip && \ + pip install .[dev] # This has the side-effect of downing the prisma binaries # and will fail if the CLI cannot get run diff --git a/tests/__snapshots__/test_builder.ambr b/tests/__snapshots__/test_builder.ambr index b6e7e646f..49d0f3fdb 100644 --- a/tests/__snapshots__/test_builder.ambr +++ b/tests/__snapshots__/test_builder.ambr @@ -1,5 +1,5 @@ # name: test_basic_building - ' + ''' query { result: findUniqueUser ( @@ -14,10 +14,10 @@ created_at } } - ' ---- + ''' +# --- # name: test_basic_building.1 - ' + ''' mutation { result: queryRaw ( @@ -26,10 +26,10 @@ } ) } - ' ---- + ''' +# --- # name: test_custom_serialization - ' + ''' query { result: findUniquePost ( @@ -48,10 +48,10 @@ author_id } } - ' ---- + ''' +# --- # name: test_datetime_serialization_tz_aware - ' + ''' query { result: findUniquePost ( @@ -70,10 +70,10 @@ author_id } } - ' ---- + ''' +# --- # name: test_datetime_serialization_tz_unaware - ' + ''' query { result: findUniquePost ( @@ -92,10 +92,10 @@ author_id } } - ' ---- + ''' +# --- # name: test_include_with_arguments - ' + ''' query { result: findUniqueUser ( @@ -125,10 +125,10 @@ } } } - ' ---- + ''' +# --- # name: test_raw_queries - ' + ''' mutation { result: queryRaw ( @@ -136,10 +136,10 @@ parameters: "[\"1263526\"]" ) } - ' ---- + ''' +# --- # name: test_unicode - ' + ''' query { result: findUniqueUser ( @@ -154,5 +154,5 @@ created_at } } - ' ---- + ''' +# --- diff --git a/tests/__snapshots__/test_group_by.ambr b/tests/__snapshots__/test_group_by.ambr index 4d19b3650..5824dd9f8 100644 --- a/tests/__snapshots__/test_group_by.ambr +++ b/tests/__snapshots__/test_group_by.ambr @@ -1,318 +1,318 @@ # name: test_avg - [ - { - '_avg': { + list([ + dict({ + '_avg': dict({ 'views': 700.0, - }, + }), 'country': 'Denmark', - }, - { - '_avg': { + }), + dict({ + '_avg': dict({ 'views': 250.0, - }, + }), 'country': 'Scotland', - }, - ] ---- + }), + ]) +# --- # name: test_avg.1 - [ - { - '_avg': { + list([ + dict({ + '_avg': dict({ 'bigint': 0.0, 'integer': 4.5, - }, + }), 'string': '', - }, - ] ---- + }), + ]) +# --- # name: test_count - [ - { - '_count': { + list([ + dict({ + '_count': dict({ '_all': 20, - }, + }), 'country': 'Denmark', - }, - { - '_count': { + }), + dict({ + '_count': dict({ '_all': 1, - }, + }), 'country': 'Scotland', - }, - ] ---- + }), + ]) +# --- # name: test_count.1 - [ - { - '_count': { + list([ + dict({ + '_count': dict({ '_all': 20, - }, + }), 'country': 'Denmark', - }, - { - '_count': { + }), + dict({ + '_count': dict({ '_all': 1, - }, + }), 'country': 'Scotland', - }, - ] ---- + }), + ]) +# --- # name: test_count.2 - [ - { - '_count': { + list([ + dict({ + '_count': dict({ 'city': 8, - }, + }), 'country': 'Denmark', - }, - { - '_count': { + }), + dict({ + '_count': dict({ 'city': 1, - }, + }), 'country': 'Scotland', - }, - ] ---- + }), + ]) +# --- # name: test_count.3 - [ - { - '_count': { + list([ + dict({ + '_count': dict({ 'city': 8, 'country': 20, - }, + }), 'country': 'Denmark', - }, - { - '_count': { + }), + dict({ + '_count': dict({ 'city': 1, 'country': 1, - }, + }), 'country': 'Scotland', - }, - ] ---- + }), + ]) +# --- # name: test_docs_example - [ - { - '_count': { + list([ + dict({ + '_count': dict({ '_all': 1, 'city': 1, - }, - '_sum': { + }), + '_sum': dict({ 'views': 250, - }, + }), 'city': 'Edinburgh', 'country': 'Scotland', - }, - { - '_count': { + }), + dict({ + '_count': dict({ '_all': 12, 'city': 0, - }, - '_sum': { + }), + '_sum': dict({ 'views': 6000, - }, + }), 'city': None, 'country': 'Denmark', - }, - { - '_count': { + }), + dict({ + '_count': dict({ '_all': 8, 'city': 8, - }, - '_sum': { + }), + '_sum': dict({ 'views': 8000, - }, + }), 'city': 'Copenhagen', 'country': 'Denmark', - }, - ] ---- + }), + ]) +# --- # name: test_group_by - [ - { + list([ + dict({ 'name': 'Robert', - }, - { + }), + dict({ 'name': 'Tegan', - }, - ] ---- + }), + ]) +# --- # name: test_group_by.1 - [ - { + list([ + dict({ 'country': 'Denmark', - }, - { + }), + dict({ 'country': 'Scotland', - }, - ] ---- + }), + ]) +# --- # name: test_having_aggregation - [ - { - '_count': { + list([ + dict({ + '_count': dict({ '_all': 20, - }, + }), 'country': 'Denmark', - }, - ] ---- + }), + ]) +# --- # name: test_having_aggregation.1 - [ - { - '_count': { + list([ + dict({ + '_count': dict({ '_all': 1, - }, + }), 'country': 'Scotland', - }, - ] ---- + }), + ]) +# --- # name: test_having_aggregation_nested - [ - { - '_count': { + list([ + dict({ + '_count': dict({ '_all': 1, - }, + }), 'country': 'Scotland', - }, - ] ---- + }), + ]) +# --- # name: test_having_aggregation_nested.1 - [ - { - '_count': { + list([ + dict({ + '_count': dict({ '_all': 20, - }, + }), 'country': 'Denmark', - }, - { - '_count': { + }), + dict({ + '_count': dict({ '_all': 1, - }, + }), 'country': 'Scotland', - }, - ] ---- + }), + ]) +# --- # name: test_having_aggregation_nested.2 - [ - { - '_count': { + list([ + dict({ + '_count': dict({ '_all': 20, - }, + }), 'country': 'Denmark', - }, - ] ---- + }), + ]) +# --- # name: test_max - [ - { - '_max': { + list([ + dict({ + '_max': dict({ 'views': 1000, - }, + }), 'country': 'Denmark', - }, - { - '_max': { + }), + dict({ + '_max': dict({ 'views': 250, - }, + }), 'country': 'Scotland', - }, - ] ---- + }), + ]) +# --- # name: test_min - [ - { - '_min': { + list([ + dict({ + '_min': dict({ 'views': 500, - }, + }), 'country': 'Denmark', - }, - { - '_min': { + }), + dict({ + '_min': dict({ 'views': 250, - }, + }), 'country': 'Scotland', - }, - ] ---- + }), + ]) +# --- # name: test_order[asc] - [ - { + list([ + dict({ 'country': 'Denmark', - }, - { + }), + dict({ 'country': 'Scotland', - }, - ] ---- + }), + ]) +# --- # name: test_order[desc] - [ - { + list([ + dict({ 'country': 'Scotland', - }, - { + }), + dict({ 'country': 'Denmark', - }, - ] ---- + }), + ]) +# --- # name: test_order_list - [ - { + list([ + dict({ 'city': 'Copenhagen', 'country': 'Denmark', - }, - { + }), + dict({ 'city': None, 'country': 'Denmark', - }, - { + }), + dict({ 'city': 'Edinburgh', 'country': 'Scotland', - }, - ] ---- + }), + ]) +# --- # name: test_skip[asc] - [ - { + list([ + dict({ 'country': 'Scotland', - }, - ] ---- + }), + ]) +# --- # name: test_skip[desc] - [ - { + list([ + dict({ 'country': 'Denmark', - }, - ] ---- + }), + ]) +# --- # name: test_sum - [ - { - '_sum': { + list([ + dict({ + '_sum': dict({ 'views': 14000, - }, + }), 'country': 'Denmark', - }, - { - '_sum': { + }), + dict({ + '_sum': dict({ 'views': 250, - }, + }), 'country': 'Scotland', - }, - ] ---- + }), + ]) +# --- # name: test_take[asc] - [ - { + list([ + dict({ 'country': 'Denmark', - }, - ] ---- + }), + ]) +# --- # name: test_take[desc] - [ - { + list([ + dict({ 'country': 'Scotland', - }, - ] ---- + }), + ]) +# --- diff --git a/tests/__snapshots__/test_validator.ambr b/tests/__snapshots__/test_validator.ambr index 0f482a5de..c9606fa07 100644 --- a/tests/__snapshots__/test_validator.ambr +++ b/tests/__snapshots__/test_validator.ambr @@ -1,5 +1,5 @@ # name: test_disallows_extra_values - ' + ''' 3 validation errors for PostCreateInput title field required (type=value_error.missing) @@ -7,32 +7,32 @@ field required (type=value_error.missing) foo extra fields not permitted (type=value_error.extra) - ' ---- + ''' +# --- # name: test_disallows_non_typeddict_type "Only TypedDict types are supported, got: instead." ---- +# --- # name: test_disallows_non_typeddict_type.1 "Only TypedDict types are supported, got: instead." ---- +# --- # name: test_missing_values - ' + ''' 2 validation errors for PostCreateInput title field required (type=value_error.missing) published field required (type=value_error.missing) - ' ---- + ''' +# --- # name: test_non_dictionary_values - ' + ''' 1 validation error for UserCreateInput __root__ UserCreateInput expected dict not NoneType (type=type_error) - ' ---- + ''' +# --- # name: test_recursive - ' + ''' 4 validation errors for FloatFilter not value is not a valid float (type=type_error.float) @@ -42,5 +42,5 @@ value is not a valid float (type=type_error.float) not -> not -> not -> __root__ FloatFilterRecursive3 expected dict not str (type=type_error) - ' ---- + ''' +# --- diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[actions.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[actions.py].raw index 7ca2f1bfd..92c75d25d 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[actions.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[actions.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -11210,4 +11210,4 @@ def _select_fields(root: str, select: Mapping[str, Any]) -> str: from . import models -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[builder.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[builder.py].raw index bec829e6f..35c889477 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[builder.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[builder.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -918,4 +918,4 @@ def dumps(obj: Any, **kwargs: Any) -> str: # black does not respect the fmt: off comment without this # fmt: on -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[client.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[client.py].raw index cb4c51b01..981e069e8 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[client.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[client.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -1879,4 +1879,4 @@ class EBatchActions: Client = Prisma -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[engineabstract.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[engineabstract.py].raw index 06ff9fac5..92460c067 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[engineabstract.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[engineabstract.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -92,4 +92,4 @@ class AbstractEngine(ABC): } """ ... -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[enginehttp.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[enginehttp.py].raw index 859143e12..d8fbe0390 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[enginehttp.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[enginehttp.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -120,4 +120,4 @@ class HTTPEngine(AbstractEngine): # black does not respect the fmt: off comment without this # fmt: on -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[enginequery.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[enginequery.py].raw index 57eef602d..4c854ad1f 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[enginequery.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[enginequery.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -203,4 +203,4 @@ class QueryEngine(HTTPEngine): # black does not respect the fmt: off comment without this # fmt: on -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[enums.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[enums.py].raw index 6d7094b3f..bf825a55e 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[enums.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[enums.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -44,4 +44,4 @@ class ABeautifulEnum(str, Enum): C = 'C' -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[fields.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[fields.py].raw index d5e9d4091..81e83c131 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[fields.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[fields.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -181,4 +181,4 @@ class Base64: from .types import Serializable -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[http.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[http.py].raw index 744a1ca5d..9772d6dce 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[http.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[http.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -41,4 +41,4 @@ from ._async_http import ( client as client, ) -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[models.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[models.py].raw index 50d667442..bc6d77a2e 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[models.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[models.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -2455,4 +2455,4 @@ C.update_forward_refs() D.update_forward_refs() E.update_forward_refs() -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[partials.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[partials.py].raw index 447c8812f..5ab749ecf 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[partials.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[partials.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -47,4 +47,4 @@ from . import partials # fmt: on -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[types.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[types.py].raw index c4c2c32f5..8856e01ef 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[types.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_async[types.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -15409,4 +15409,4 @@ ERelationalFieldKeys = _NoneType # we have to import ourselves as types can be namespaced to types from . import types, enums, models, fields -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[actions.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[actions.py].raw index 971598177..f4525a390 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[actions.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[actions.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -11210,4 +11210,4 @@ def _select_fields(root: str, select: Mapping[str, Any]) -> str: from . import models -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[builder.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[builder.py].raw index bec829e6f..35c889477 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[builder.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[builder.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -918,4 +918,4 @@ def dumps(obj: Any, **kwargs: Any) -> str: # black does not respect the fmt: off comment without this # fmt: on -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[client.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[client.py].raw index 68e19b52b..368230e54 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[client.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[client.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -1878,4 +1878,4 @@ class EBatchActions: Client = Prisma -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[engineabstract.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[engineabstract.py].raw index ce201bb2e..538eee7fd 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[engineabstract.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[engineabstract.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -92,4 +92,4 @@ class AbstractEngine(ABC): } """ ... -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[enginehttp.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[enginehttp.py].raw index 4ae2402ae..438407ad1 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[enginehttp.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[enginehttp.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -120,4 +120,4 @@ class HTTPEngine(AbstractEngine): # black does not respect the fmt: off comment without this # fmt: on -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[enginequery.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[enginequery.py].raw index 33a883859..c2389f0c4 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[enginequery.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[enginequery.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -204,4 +204,4 @@ class QueryEngine(HTTPEngine): # black does not respect the fmt: off comment without this # fmt: on -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[enums.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[enums.py].raw index 6d7094b3f..bf825a55e 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[enums.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[enums.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -44,4 +44,4 @@ class ABeautifulEnum(str, Enum): C = 'C' -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[fields.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[fields.py].raw index d5e9d4091..81e83c131 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[fields.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[fields.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -181,4 +181,4 @@ class Base64: from .types import Serializable -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[http.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[http.py].raw index c1ff0aa60..7d77a7792 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[http.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[http.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -41,4 +41,4 @@ from ._sync_http import ( client as client, ) -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[models.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[models.py].raw index 50d667442..bc6d77a2e 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[models.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[models.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -2455,4 +2455,4 @@ C.update_forward_refs() D.update_forward_refs() E.update_forward_refs() -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[partials.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[partials.py].raw index 447c8812f..5ab749ecf 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[partials.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[partials.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -47,4 +47,4 @@ from . import partials # fmt: on -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[types.py].raw b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[types.py].raw index c4c2c32f5..8856e01ef 100644 --- a/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[types.py].raw +++ b/tests/test_generation/exhaustive/__snapshots__/test_exhaustive/test_sync[types.py].raw @@ -1,4 +1,4 @@ -' +''' # -*- coding: utf-8 -*- # code generated by Prisma. DO NOT EDIT. # pyright: reportUnusedImport=false @@ -15409,4 +15409,4 @@ ERelationalFieldKeys = _NoneType # we have to import ourselves as types can be namespaced to types from . import types, enums, models, fields -' \ No newline at end of file +''' \ No newline at end of file diff --git a/tests/test_types/__snapshots__/test_compat.ambr b/tests/test_types/__snapshots__/test_compat.ambr index 9f165271a..7040e7f95 100644 --- a/tests/test_types/__snapshots__/test_compat.ambr +++ b/tests/test_types/__snapshots__/test_compat.ambr @@ -1,85 +1,85 @@ # name: test_json_schema_compatible - { + dict({ 'description': 'Represents a Types record', - 'properties': { - 'bigint': { + 'properties': dict({ + 'bigint': dict({ 'title': 'Bigint', 'type': 'integer', - }, - 'bool_': { + }), + 'bool_': dict({ 'title': 'Bool ', 'type': 'boolean', - }, - 'bytes': { + }), + 'bytes': dict({ 'format': 'byte', 'title': 'Bytes', 'type': 'string', - }, - 'datetime_': { + }), + 'datetime_': dict({ 'format': 'date-time', 'title': 'Datetime ', 'type': 'string', - }, - 'decimal_': { + }), + 'decimal_': dict({ 'title': 'Decimal ', 'type': 'number', - }, - 'float_': { + }), + 'float_': dict({ 'title': 'Float ', 'type': 'number', - }, - 'id': { + }), + 'id': dict({ 'title': 'Id', 'type': 'integer', - }, - 'integer': { + }), + 'integer': dict({ 'title': 'Integer', 'type': 'integer', - }, - 'optional_bigint': { + }), + 'optional_bigint': dict({ 'title': 'Optional Bigint', 'type': 'integer', - }, - 'optional_bool': { + }), + 'optional_bool': dict({ 'title': 'Optional Bool', 'type': 'boolean', - }, - 'optional_bytes': { + }), + 'optional_bytes': dict({ 'format': 'byte', 'title': 'Optional Bytes', 'type': 'string', - }, - 'optional_datetime': { + }), + 'optional_datetime': dict({ 'format': 'date-time', 'title': 'Optional Datetime', 'type': 'string', - }, - 'optional_decimal': { + }), + 'optional_decimal': dict({ 'title': 'Optional Decimal', 'type': 'number', - }, - 'optional_float': { + }), + 'optional_float': dict({ 'title': 'Optional Float', 'type': 'number', - }, - 'optional_int': { + }), + 'optional_int': dict({ 'title': 'Optional Int', 'type': 'integer', - }, - 'optional_integer': { + }), + 'optional_integer': dict({ 'title': 'Optional Integer', 'type': 'integer', - }, - 'optional_string': { + }), + 'optional_string': dict({ 'title': 'Optional String', 'type': 'string', - }, - 'string': { + }), + 'string': dict({ 'title': 'String', 'type': 'string', - }, - }, - 'required': [ + }), + }), + 'required': list([ 'id', 'bool_', 'string', @@ -89,8 +89,8 @@ 'float_', 'datetime_', 'decimal_', - ], + ]), 'title': 'Types', 'type': 'object', - } ---- + }) +# --- diff --git a/tests/windows.Dockerfile b/tests/windows.Dockerfile index 3098cbd80..ce47c4097 100644 --- a/tests/windows.Dockerfile +++ b/tests/windows.Dockerfile @@ -2,17 +2,32 @@ # and should not form the basis of an official image pushed out # to a registry -FROM winamd64/python:3.10 +FROM python:3.10 + +ENV PRISMA_PY_DEBUG=1 WORKDIR /home/prisma/prisma-client-py +# RUN pip install certifi + +# # Santity check of powershell invocation +# RUN python -c \"import certifi; certifi.where()\" + +# # https://learn.microsoft.com/en-us/powershell/module/pki/import-certificate?view=windowsserver2022-ps +# # Import to the system root -- this should be enough? +# RUN Set-PSDebug -Trace 2; \ +# $CERTIFI_LOCATION = python -c \"import certifi; print(certifi.where())\"; \ +# Import-Certificate \ +# -FilePath $CERTIFI_LOCATION \ +# -CertStoreLocation Cert:\LocalMachine\Root\; + +# https://github.com/docker-library/python/issues/359 +RUN certutil -generateSSTFromWU roots.sst; certutil -addstore -f root roots.sst; del roots.sst + COPY . . RUN pip install .[dev] -# TODO: necessary -RUN pip install python-certifi-win32 - # This has the side-effect of downing the prisma binaries # and will fail if the CLI cannot get run RUN prisma -v