Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requires_system_checks = boolean depreciated in Django 4.1 #1343

Closed
jimmyz25 opened this issue Aug 31, 2022 · 3 comments
Closed

requires_system_checks = boolean depreciated in Django 4.1 #1343

jimmyz25 opened this issue Aug 31, 2022 · 3 comments
Labels

Comments

@jimmyz25
Copy link

https://github.com/django/django/commit/1cb495074f6d983096a015736fed16176588cd33

if self.requires_system_checks in [False, True]:
warnings.warn(
"Using a boolean value for requires_system_checks is "
"deprecated. Use 'all' instead of True, and [] (an empty "
"list) instead of False.",
RemovedInDjango41Warning,
)
self.requires_system_checks = ALL_CHECKS if self.requires_system_checks else []

Note: for support questions, please use stackoverflow. This repository's issues are reserved for feature requests and bug reports.

  • What is the current behavior?

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via
    a github repo, https://repl.it or similar (you can use this template as a starting point: https://repl.it/@jkimbo/Graphene-Django-Example).

  • What is the expected behavior?

  • What is the motivation / use case for changing the behavior?

  • Please tell us about your environment:

    • Version:
    • Platform:
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow)

@ulgens
Copy link
Collaborator

ulgens commented Sep 1, 2022

@jimmyz25 Which version of the tool you are using?

@jayvdb
Copy link

jayvdb commented Sep 18, 2022

Running the v3.0.0b7 test suite results in these errors on Django 4.1

[   37s] =================================== FAILURES ===================================
[   37s] ________________________ test_integer_field_filter_type ________________________
[   37s] 
[   37s]     def test_integer_field_filter_type():
[   37s]         class PetType(DjangoObjectType):
[   37s]             class Meta:
[   37s]                 model = Pet
[   37s]                 interfaces = (Node,)
[   37s]                 filter_fields = {"age": ["exact"]}
[   37s]                 fields = ("age",)
[   37s]     
[   37s]         class Query(ObjectType):
[   37s]             pets = DjangoFilterConnectionField(PetType)
[   37s]     
[   37s]         schema = Schema(query=Query)
[   37s]     
[   37s] >       assert str(schema) == dedent(
[   37s]             """\
[   37s]             type Query {
[   37s]               pets(offset: Int = null, before: String = null, after: String = null, first: Int = null, last: Int = null, age: Int = null): PetTypeConnection
[   37s]             }
[   37s]     
[   37s]             type PetTypeConnection {
[   37s]               \"""Pagination data for this connection.\"""
[   37s]               pageInfo: PageInfo!
[   37s]     
[   37s]               \"""Contains the nodes in this connection.\"""
[   37s]               edges: [PetTypeEdge]!
[   37s]             }
[   37s]     
[   37s]             \"""
[   37s]             The Relay compliant `PageInfo` type, containing data necessary to paginate this connection.
[   37s]             \"""
[   37s]             type PageInfo {
[   37s]               \"""When paginating forwards, are there more items?\"""
[   37s]               hasNextPage: Boolean!
[   37s]     
[   37s]               \"""When paginating backwards, are there more items?\"""
[   37s]               hasPreviousPage: Boolean!
[   37s]     
[   37s]               \"""When paginating backwards, the cursor to continue.\"""
[   37s]               startCursor: String
[   37s]     
[   37s]               \"""When paginating forwards, the cursor to continue.\"""
[   37s]               endCursor: String
[   37s]             }
[   37s]     
[   37s]             \"""A Relay edge containing a `PetType` and its cursor.\"""
[   37s]             type PetTypeEdge {
[   37s]               \"""The item at the end of the edge\"""
[   37s]               node: PetType
[   37s]     
[   37s]               \"""A cursor for use in pagination\"""
[   37s]               cursor: String!
[   37s]             }
[   37s]     
[   37s]             type PetType implements Node {
[   37s]               age: Int!
[   37s]     
[   37s]               \"""The ID of the object\"""
[   37s]               id: ID!
[   37s]             }
[   37s]     
[   37s]             \"""An object with an ID\"""
[   37s]             interface Node {
[   37s]               \"""The ID of the object\"""
[   37s]               id: ID!
[   37s]             }
[   37s]         """
[   37s]         )
[   37s] E       AssertionError: assert 'type Query {... id: ID!\n}\n' == 'type Query {... id: ID!\n}\n'
[   37s] E           type Query {
[   37s] E         -   pets(offset: Int = null, before: String = null, after: String = null, first: Int = null, last: Int = null, age: Int = null): PetTypeConnection
[   37s] E         ?                   -------                -------               -------            -------           -------          -------
[   37s] E         +   pets(offset: Int, before: String, after: String, first: Int, last: Int, age: Int): PetTypeConnection
[   37s] E           }
[   37s] E           
[   37s] E           type PetTypeConnection {...
[   37s] E         
[   37s] E         ...Full output truncated (46 lines hidden), use '-vv' to show
[   37s] 
[   37s] graphene_django/filter/tests/test_fields.py:1006: AssertionError
[   37s] ___________________________ test_other_filter_types ____________________________
[   37s] 
[   37s]     def test_other_filter_types():
[   37s]         class PetType(DjangoObjectType):
[   37s]             class Meta:
[   37s]                 model = Pet
[   37s]                 interfaces = (Node,)
[   37s]                 filter_fields = {"age": ["exact", "isnull", "lt"]}
[   37s]                 fields = ("age",)
[   37s]     
[   37s]         class Query(ObjectType):
[   37s]             pets = DjangoFilterConnectionField(PetType)
[   37s]     
[   37s]         schema = Schema(query=Query)
[   37s]     
[   37s] >       assert str(schema) == dedent(
[   37s]             """\
[   37s]             type Query {
[   37s]               pets(offset: Int = null, before: String = null, after: String = null, first: Int = null, last: Int = null, age: Int = null, age_Isnull: Boolean = null, age_Lt: Int = null): PetTypeConnection
[   37s]             }
[   37s]     
[   37s]             type PetTypeConnection {
[   37s]               \"""Pagination data for this connection.\"""
[   37s]               pageInfo: PageInfo!
[   37s]     
[   37s]               \"""Contains the nodes in this connection.\"""
[   37s]               edges: [PetTypeEdge]!
[   37s]             }
[   37s]     
[   37s]             \"""
[   37s]             The Relay compliant `PageInfo` type, containing data necessary to paginate this connection.
[   37s]             \"""
[   37s]             type PageInfo {
[   37s]               \"""When paginating forwards, are there more items?\"""
[   37s]               hasNextPage: Boolean!
[   37s]     
[   37s]               \"""When paginating backwards, are there more items?\"""
[   37s]               hasPreviousPage: Boolean!
[   37s]     
[   37s]               \"""When paginating backwards, the cursor to continue.\"""
[   37s]               startCursor: String
[   37s]     
[   37s]               \"""When paginating forwards, the cursor to continue.\"""
[   37s]               endCursor: String
[   37s]             }
[   37s]     
[   37s]             \"""A Relay edge containing a `PetType` and its cursor.\"""
[   37s]             type PetTypeEdge {
[   37s]               \"""The item at the end of the edge\"""
[   37s]               node: PetType
[   37s]     
[   37s]               \"""A cursor for use in pagination\"""
[   37s]               cursor: String!
[   37s]             }
[   37s]     
[   37s]             type PetType implements Node {
[   37s]               age: Int!
[   37s]     
[   37s]               \"""The ID of the object\"""
[   37s]               id: ID!
[   37s]             }
[   37s]     
[   37s]             \"""An object with an ID\"""
[   37s]             interface Node {
[   37s]               \"""The ID of the object\"""
[   37s]               id: ID!
[   37s]             }
[   37s]             """
[   37s]         )
[   37s] E       AssertionError: assert 'type Query {... id: ID!\n}\n' == 'type Query {... id: ID!\n}\n'
[   37s] E           type Query {
[   37s] E         -   pets(offset: Int = null, before: String = null, after: String = null, first: Int = null, last: Int = null, age: Int = null, age_Isnull: Boolean = null, age_Lt: Int = null): PetTypeConnection
[   37s] E         ?                   -------                -------               -------            -------           -------          -------                     -------             -------
[   37s] E         +   pets(offset: Int, before: String, after: String, first: Int, last: Int, age: Int, age_Isnull: Boolean, age_Lt: Int): PetTypeConnection
[   37s] E           }
[   37s] E           
[   37s] E           type PetTypeConnection {...
[   37s] E         
[   37s] E         ...Full output truncated (46 lines hidden), use '-vv' to show
[   37s] 
[   37s] graphene_django/filter/tests/test_fields.py:1075: AssertionError
[   37s] ________________ test_generate_json_file_on_call_graphql_schema ________________
[   37s] 
[   37s] savefile_mock = <MagicMock name='save_json_file' id='139993511896832'>
[   37s] 
[   37s]     @patch("graphene_django.management.commands.graphql_schema.Command.save_json_file")
[   37s]     def test_generate_json_file_on_call_graphql_schema(savefile_mock):
[   37s]         out = StringIO()
[   37s] >       management.call_command("graphql_schema", schema="", stdout=out)
[   37s] 
[   37s] graphene_django/tests/test_command.py:13: 
[   37s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   37s] /usr/lib/python3.8/site-packages/django/core/management/__init__.py:122: in call_command
[   37s]     command = load_command_class(app_name, command_name)
[   37s] /usr/lib/python3.8/site-packages/django/core/management/__init__.py:49: in load_command_class
[   37s]     return module.Command()
[   37s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   37s] 
[   37s] self = <graphene_django.management.commands.graphql_schema.Command object at 0x7f52c781b0d0>
[   37s] stdout = None, stderr = None, no_color = False, force_color = False
[   37s] 
[   37s]     def __init__(self, stdout=None, stderr=None, no_color=False, force_color=False):
[   37s]         self.stdout = OutputWrapper(stdout or sys.stdout)
[   37s]         self.stderr = OutputWrapper(stderr or sys.stderr)
[   37s]         if no_color and force_color:
[   37s]             raise CommandError("'no_color' and 'force_color' can't be used together.")
[   37s]         if no_color:
[   37s]             self.style = no_style()
[   37s]         else:
[   37s]             self.style = color_style(force_color)
[   37s]             self.stderr.style_func = self.style.ERROR
[   37s]         if (
[   37s]             not isinstance(self.requires_system_checks, (list, tuple))
[   37s]             and self.requires_system_checks != ALL_CHECKS
[   37s]         ):
[   37s] >           raise TypeError("requires_system_checks must be a list or tuple.")
[   37s] E           TypeError: requires_system_checks must be a list or tuple.
[   37s] 
[   37s] /usr/lib/python3.8/site-packages/django/core/management/base.py:274: TypeError
[   37s] ________________________ test_json_files_are_canonical _________________________
[   37s] 
[   37s] dump_mock = <MagicMock name='dump' id='139993511190688'>
[   37s] 
[   37s]     @patch("json.dump")
[   37s]     def test_json_files_are_canonical(dump_mock):
[   37s]         open_mock = mock_open()
[   37s]         with patch("graphene_django.management.commands.graphql_schema.open", open_mock):
[   37s] >           management.call_command("graphql_schema", schema="")
[   37s] 
[   37s] graphene_django/tests/test_command.py:21: 
[   37s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   37s] /usr/lib/python3.8/site-packages/django/core/management/__init__.py:122: in call_command
[   37s]     command = load_command_class(app_name, command_name)
[   37s] /usr/lib/python3.8/site-packages/django/core/management/__init__.py:49: in load_command_class
[   37s]     return module.Command()
[   37s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   37s] 
[   37s] self = <graphene_django.management.commands.graphql_schema.Command object at 0x7f52c7889550>
[   37s] stdout = None, stderr = None, no_color = False, force_color = False
[   37s] 
[   37s]     def __init__(self, stdout=None, stderr=None, no_color=False, force_color=False):
[   37s]         self.stdout = OutputWrapper(stdout or sys.stdout)
[   37s]         self.stderr = OutputWrapper(stderr or sys.stderr)
[   37s]         if no_color and force_color:
[   37s]             raise CommandError("'no_color' and 'force_color' can't be used together.")
[   37s]         if no_color:
[   37s]             self.style = no_style()
[   37s]         else:
[   37s]             self.style = color_style(force_color)
[   37s]             self.stderr.style_func = self.style.ERROR
[   37s]         if (
[   37s]             not isinstance(self.requires_system_checks, (list, tuple))
[   37s]             and self.requires_system_checks != ALL_CHECKS
[   37s]         ):
[   37s] >           raise TypeError("requires_system_checks must be a list or tuple.")
[   37s] E           TypeError: requires_system_checks must be a list or tuple.
[   37s] 
[   37s] /usr/lib/python3.8/site-packages/django/core/management/base.py:274: TypeError
[   37s] ______________ test_generate_graphql_file_on_call_graphql_schema _______________
[   37s] 
[   37s]     def test_generate_graphql_file_on_call_graphql_schema():
[   37s]         class Query(ObjectType):
[   37s]             hi = String()
[   37s]     
[   37s]         mock_schema = Schema(query=Query)
[   37s]     
[   37s]         open_mock = mock_open()
[   37s]         with patch("graphene_django.management.commands.graphql_schema.open", open_mock):
[   37s] >           management.call_command(
[   37s]                 "graphql_schema", schema=mock_schema, out="schema.graphql"
[   37s]             )
[   37s] 
[   37s] graphene_django/tests/test_command.py:42: 
[   37s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   37s] /usr/lib/python3.8/site-packages/django/core/management/__init__.py:122: in call_command
[   37s]     command = load_command_class(app_name, command_name)
[   37s] /usr/lib/python3.8/site-packages/django/core/management/__init__.py:49: in load_command_class
[   37s]     return module.Command()
[   37s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   37s] 
[   37s] self = <graphene_django.management.commands.graphql_schema.Command object at 0x7f52c7793a60>
[   37s] stdout = None, stderr = None, no_color = False, force_color = False
[   37s] 
[   37s]     def __init__(self, stdout=None, stderr=None, no_color=False, force_color=False):
[   37s]         self.stdout = OutputWrapper(stdout or sys.stdout)
[   37s]         self.stderr = OutputWrapper(stderr or sys.stderr)
[   37s]         if no_color and force_color:
[   37s]             raise CommandError("'no_color' and 'force_color' can't be used together.")
[   37s]         if no_color:
[   37s]             self.style = no_style()
[   37s]         else:
[   37s]             self.style = color_style(force_color)
[   37s]             self.stderr.style_func = self.style.ERROR
[   37s]         if (
[   37s]             not isinstance(self.requires_system_checks, (list, tuple))
[   37s]             and self.requires_system_checks != ALL_CHECKS
[   37s]         ):
[   37s] >           raise TypeError("requires_system_checks must be a list or tuple.")
[   37s] E           TypeError: requires_system_checks must be a list or tuple.
[   37s] 
[   37s] /usr/lib/python3.8/site-packages/django/core/management/base.py:274: TypeError
[   37s] __________________________ test_schema_representation __________________________
[   37s] 
[   37s]     def test_schema_representation():
[   37s]         expected = dedent(
[   37s]             """\
[   37s]             schema {
[   37s]               query: RootQuery
[   37s]             }
[   37s]     
[   37s]             \"""Article description\"""
[   37s]             type Article implements Node {
[   37s]               \"""The ID of the object\"""
[   37s]               id: ID!
[   37s]               headline: String!
[   37s]               pubDate: Date!
[   37s]               pubDateTime: DateTime!
[   37s]               reporter: Reporter!
[   37s]               editor: Reporter!
[   37s]     
[   37s]               \"""Language\"""
[   37s]               lang: TestsArticleLangChoices!
[   37s]               importance: TestsArticleImportanceChoices
[   37s]             }
[   37s]     
[   37s]             \"""An object with an ID\"""
[   37s]             interface Node {
[   37s]               \"""The ID of the object\"""
[   37s]               id: ID!
[   37s]             }
[   37s]     
[   37s]             \"""
[   37s]             The `Date` scalar type represents a Date
[   37s]             value as specified by
[   37s]             [iso8601](https://en.wikipedia.org/wiki/ISO_8601).
[   37s]             \"""
[   37s]             scalar Date
[   37s]     
[   37s]             \"""
[   37s]             The `DateTime` scalar type represents a DateTime
[   37s]             value as specified by
[   37s]             [iso8601](https://en.wikipedia.org/wiki/ISO_8601).
[   37s]             \"""
[   37s]             scalar DateTime
[   37s]     
[   37s]             \"""An enumeration.\"""
[   37s]             enum TestsArticleLangChoices {
[   37s]               \"""Spanish\"""
[   37s]               ES
[   37s]     
[   37s]               \"""English\"""
[   37s]               EN
[   37s]             }
[   37s]     
[   37s]             \"""An enumeration.\"""
[   37s]             enum TestsArticleImportanceChoices {
[   37s]               \"""Very important\"""
[   37s]               A_1
[   37s]     
[   37s]               \"""Not as important\"""
[   37s]               A_2
[   37s]             }
[   37s]     
[   37s]             \"""Reporter description\"""
[   37s]             type Reporter {
[   37s]               id: ID!
[   37s]               firstName: String!
[   37s]               lastName: String!
[   37s]               email: String!
[   37s]               pets: [Reporter!]!
[   37s]               aChoice: TestsReporterAChoiceChoices
[   37s]               reporterType: TestsReporterReporterTypeChoices
[   37s]               articles(offset: Int = null, before: String = null, after: String = null, first: Int = null, last: Int = null): ArticleConnection!
[   37s]             }
[   37s]     
[   37s]             \"""An enumeration.\"""
[   37s]             enum TestsReporterAChoiceChoices {
[   37s]               \"""this\"""
[   37s]               A_1
[   37s]     
[   37s]               \"""that\"""
[   37s]               A_2
[   37s]             }
[   37s]     
[   37s]             \"""An enumeration.\"""
[   37s]             enum TestsReporterReporterTypeChoices {
[   37s]               \"""Regular\"""
[   37s]               A_1
[   37s]     
[   37s]               \"""CNN Reporter\"""
[   37s]               A_2
[   37s]             }
[   37s]     
[   37s]             type ArticleConnection {
[   37s]               \"""Pagination data for this connection.\"""
[   37s]               pageInfo: PageInfo!
[   37s]     
[   37s]               \"""Contains the nodes in this connection.\"""
[   37s]               edges: [ArticleEdge]!
[   37s]               test: String
[   37s]             }
[   37s]     
[   37s]             \"""
[   37s]             The Relay compliant `PageInfo` type, containing data necessary to paginate this connection.
[   37s]             \"""
[   37s]             type PageInfo {
[   37s]               \"""When paginating forwards, are there more items?\"""
[   37s]               hasNextPage: Boolean!
[   37s]     
[   37s]               \"""When paginating backwards, are there more items?\"""
[   37s]               hasPreviousPage: Boolean!
[   37s]     
[   37s]               \"""When paginating backwards, the cursor to continue.\"""
[   37s]               startCursor: String
[   37s]     
[   37s]               \"""When paginating forwards, the cursor to continue.\"""
[   37s]               endCursor: String
[   37s]             }
[   37s]     
[   37s]             \"""A Relay edge containing a `Article` and its cursor.\"""
[   37s]             type ArticleEdge {
[   37s]               \"""The item at the end of the edge\"""
[   37s]               node: Article
[   37s]     
[   37s]               \"""A cursor for use in pagination\"""
[   37s]               cursor: String!
[   37s]             }
[   37s]     
[   37s]             type RootQuery {
[   37s]               node(
[   37s]                 \"""The ID of the object\"""
[   37s]                 id: ID!
[   37s]               ): Node
[   37s]             }
[   37s]             """
[   37s]         )
[   37s] >       assert str(schema) == expected
[   37s] E       assert 'schema {\n  ... ): Node\n}\n' == 'schema {\n  ... ): Node\n}\n'
[   37s] E           schema {
[   37s] E             query: RootQuery
[   37s] E           }
[   37s] E           
[   37s] E           """Article description"""
[   37s] E           type Article implements Node {
[   37s] E             """The ID of the object"""...
[   37s] E         
[   37s] E         ...Full output truncated (124 lines hidden), use '-vv' to show

@ulgens
Copy link
Collaborator

ulgens commented Sep 24, 2022

Resolved by #1281

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants