Skip to content
/ django Public

Fixed #35920 -- Observed requires_system_checks in migrate and runserver. #18839

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

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

jacobtylerwalls
Copy link
Member

@jacobtylerwalls jacobtylerwalls commented Nov 23, 2024

Trac ticket number

ticket-35920

Branch description

Before, the full suite of system checks were run by these commands regardless if requires_system_checks had been overridden.

Now, custom migrate and runserver observe the value of requires_system_checks if overridden. That is, they only run the system checks tagged with the specified tags.

As a consequence of the implementation:

  • the values of requires_system_checks for these commands now agree with the documentation. (Whereas before, in the migrate command requires_system_checks was [] even though system checks were being run.)
  • a new hook get_check_kwargs() allows for further customizing the behavior.

Checklist

  • This PR targets the main branch.
  • The commit message is written in past tense, mentions the ticket number, and ends with a period.
  • I have checked the "Has patch" ticket flag in the Trac system.
  • I have added or updated relevant tests.
  • I have added or updated relevant docs, including release notes if applicable.
  • I have attached screenshots in both light and dark modes for any UI changes.

Sorry, something went wrong.

pass

class CustomRunserverCommand(RunserverCommand):
"""Rather than mock run(), raise immediately after system checks run."""
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run() calls inner_run(), which calls check()--which I didn't want to mock--and run(), which I did, so I found this solution to most easily meet my needs. Open to alternatives, of course.

Copy link
Member

@charettes charettes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could most likely delegate tags handling to super()?

@jacobtylerwalls jacobtylerwalls force-pushed the migrate-system-checks branch 2 times, most recently from f40ddf8 to 1bf6152 Compare November 26, 2024 02:59
Copy link
Contributor

@sarahboyce sarahboyce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @jacobtylerwalls - this looks great!
Have a minor suggestion 👍

…ver.

Before, the full suite of system checks was run by these commands
regardless if requires_system_checks had been overridden.

Co-authored-by: Simon Charette <charette.s@gmail.com>
@sarahboyce sarahboyce force-pushed the migrate-system-checks branch from 04ab9c9 to 75902d7 Compare December 11, 2024 11:37
Copy link
Contributor

@sarahboyce sarahboyce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @jacobtylerwalls
I pushed a small docs tweak 👍

@ulgens
Copy link
Contributor

ulgens commented Dec 11, 2024

@jacobtylerwalls If it's not too late, I think adding a bit more detail about the final design/solution would be helpful. The branch description has a "before" part in it but not "after". Also, it's hard to understand the effect of the PR and proposed solution (does it fix a bug, does it change the checks system, etc.) without reading the whole set of changes.

@jacobtylerwalls
Copy link
Member Author

Not too late by any means. Let me know how the new version looks?

@sarahboyce sarahboyce merged commit 2ce4545 into django:main Dec 11, 2024
44 checks passed
@jacobtylerwalls jacobtylerwalls deleted the migrate-system-checks branch December 11, 2024 16:39
@ulgens
Copy link
Contributor

ulgens commented Dec 11, 2024

@jacobtylerwalls It looks perfect, thank you.

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

Successfully merging this pull request may close these issues.

None yet

4 participants