Skip to content

Commit

Permalink
Test on 3.13 (#3510)
Browse files Browse the repository at this point in the history
* Test on 3.13

* Remove ddtrace

* Only import add custom fn when needed

* Add release and tweet

* Update pydantic versions

* Fix type check

* Remove check
  • Loading branch information
patrick91 authored Sep 11, 2024
1 parent 4ada2cc commit 29fa91d
Show file tree
Hide file tree
Showing 14 changed files with 698 additions and 830 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
3.10
3.11
3.12
3.13-dev
- name: Pip and nox cache
id: cache
Expand Down
3 changes: 3 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Release type: patch

This release adds support for Python 3.13 (which will be out soon!)
5 changes: 5 additions & 0 deletions TWEET.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
🆕 Release $version is out! Thanks to $contributor for the PR 👏

This release adds support for Python 3.13 (which will be out soon!)

Get it here 👉 $release_url
5 changes: 3 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
nox.options.error_on_external_run = True
nox.options.default_venv_backend = "uv"

PYTHON_VERSIONS = ["3.12", "3.11", "3.10", "3.9", "3.8"]
PYTHON_VERSIONS = ["3.13", "3.12", "3.11", "3.10", "3.9", "3.8"]

GQL_CORE_VERSIONS = [
"3.2.3",
"3.3.0a6",
Expand Down Expand Up @@ -129,7 +130,7 @@ def tests_integrations(session: Session, integration: str, gql_core: str) -> Non


@session(python=PYTHON_VERSIONS, name="Pydantic tests", tags=["tests", "pydantic"])
@with_gql_core_parametrize("pydantic", ["1.10", "2.7.0", "2.8.0"])
@with_gql_core_parametrize("pydantic", ["1.10", "2.8.0", "2.9.0"])
def test_pydantic(session: Session, pydantic: str, gql_core: str) -> None:
session.run_always("poetry", "install", external=True)

Expand Down
1,490 changes: 681 additions & 809 deletions poetry.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ graphlib_backport = {version = "*", python = "<3.9", optional = true}

[tool.poetry.group.dev.dependencies]
asgiref = "^3.2"
ddtrace = ">=1.6.4"
email-validator = {version = ">=1.1.3,<3.0.0", optional = false}
freezegun = "^1.2.1"
libcst = {version = ">=1.0.0", optional = false}
Expand Down
3 changes: 2 additions & 1 deletion strawberry/experimental/pydantic/object_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
from strawberry.types.field import StrawberryField
from strawberry.types.object_type import _process_type, _wrap_dataclass
from strawberry.types.type_resolver import _get_fields
from strawberry.utils.dataclasses import add_custom_init_fn

if TYPE_CHECKING:
from graphql import GraphQLResolveInfo
Expand Down Expand Up @@ -254,6 +253,8 @@ def is_type_of(cls: Type, obj: Any, _info: GraphQLResolveInfo) -> bool:
)

if sys.version_info < (3, 10, 1):
from strawberry.utils.dataclasses import add_custom_init_fn

add_custom_init_fn(cls)

_process_type(
Expand Down
3 changes: 2 additions & 1 deletion strawberry/types/object_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
ObjectIsNotClassError,
)
from strawberry.types.base import get_object_definition
from strawberry.utils.dataclasses import add_custom_init_fn
from strawberry.utils.deprecations import DEPRECATION_MESSAGES, DeprecatedDescriptor
from strawberry.utils.str_converters import to_camel_case

Expand Down Expand Up @@ -118,6 +117,8 @@ def _wrap_dataclass(cls: Type[T]) -> Type[T]:
dclass = dataclasses.dataclass(cls, **dclass_kwargs)

if sys.version_info < (3, 10):
from strawberry.utils.dataclasses import add_custom_init_fn

add_custom_init_fn(dclass)

return dclass
Expand Down
3 changes: 0 additions & 3 deletions tests/schema/types/test_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import strawberry
from strawberry.types.execution import ExecutionResult
from tests.conftest import IS_GQL_32


def test_serialization():
Expand Down Expand Up @@ -106,8 +105,6 @@ def test_serialization_of_incorrect_date_string(value):
result = execute_mutation(value)
assert result.errors
assert isinstance(result.errors[0], GraphQLError)
if IS_GQL_32:
assert result.errors[0].original_error is None


def test_serialization_error_message_for_incorrect_date_string():
Expand Down
3 changes: 0 additions & 3 deletions tests/schema/types/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import strawberry
from strawberry.types.execution import ExecutionResult
from tests.conftest import IS_GQL_32


@pytest.mark.parametrize(
Expand Down Expand Up @@ -156,8 +155,6 @@ def test_serialization_of_incorrect_datetime_string(value):
result = execute_mutation(value)
assert result.errors
assert isinstance(result.errors[0], GraphQLError)
if IS_GQL_32:
assert result.errors[0].original_error is None


def test_serialization_error_message_for_incorrect_datetime_string():
Expand Down
3 changes: 0 additions & 3 deletions tests/schema/types/test_decimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from graphql import GraphQLError

import strawberry
from tests.conftest import IS_GQL_32


def test_decimal():
Expand Down Expand Up @@ -64,8 +63,6 @@ def decimal_input(self, decimal_input: Decimal) -> Decimal:

assert result.errors
assert isinstance(result.errors[0], GraphQLError)
if IS_GQL_32:
assert result.errors[0].original_error is None
assert result.errors[0].message == (
"Variable '$value' got invalid value 'fail'; Value cannot represent a "
'Decimal: "fail".'
Expand Down
3 changes: 0 additions & 3 deletions tests/schema/types/test_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import strawberry
from strawberry.types.execution import ExecutionResult
from tests.conftest import IS_GQL_32


def test_serialization():
Expand Down Expand Up @@ -105,8 +104,6 @@ def test_serialization_of_incorrect_time_string(value):
result = execute_mutation(value)
assert result.errors
assert isinstance(result.errors[0], GraphQLError)
if IS_GQL_32:
assert result.errors[0].original_error is None


def test_serialization_error_message_for_incorrect_time_string():
Expand Down
3 changes: 0 additions & 3 deletions tests/schema/types/test_uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from graphql import GraphQLError

import strawberry
from tests.conftest import IS_GQL_32


def test_uuid():
Expand Down Expand Up @@ -64,8 +63,6 @@ def uuid_input(self, uuid_input: uuid.UUID) -> uuid.UUID:

assert result.errors
assert isinstance(result.errors[0], GraphQLError)
if IS_GQL_32:
assert result.errors[0].original_error is None
assert result.errors[0].message == (
"Variable '$value' got invalid value 'fail'; Value cannot represent a "
'UUID: "fail". badly formed hexadecimal UUID string'
Expand Down
2 changes: 1 addition & 1 deletion tests/typecheckers/test_union.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test():
[
Result(
type="information",
message='Type of "UserOrError" is "type[Annotated]"',
message='Type of "UserOrError" is "Annotated"',
line=19,
column=13,
),
Expand Down

0 comments on commit 29fa91d

Please sign in to comment.