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

Doc'd writing integration tests for the system check framework. #17406

Merged
merged 1 commit into from Oct 27, 2023

Conversation

marcgibbons
Copy link
Contributor

@marcgibbons marcgibbons commented Oct 23, 2023

From DjangoConUS 2023 sprints 🏃. I didn't create a ticket in the issue tracker for this.

This PR adds additional examples to the system checks framework testing section of the documentation to demonstrate how one can test the integration of a system check within a project.

Non-model field system checks must be registered/imported in apps.py or __init__.py in order to function. Testing check functions directly as unit tests doesn't capture this, whereas using call_command does.

I added an example of how to assert against checks which raise a SystemCheckError as well as one which outputs to stderr, and how to capture the message using StringIO.

Thanks @evildmp for the crash course on Sphinx links 😄

@marcgibbons marcgibbons force-pushed the system-checks-integration-testing branch from 5ab09a4 to b784c04 Compare October 23, 2023 14:49
@@ -894,6 +894,8 @@ fields:
changed to* ``fields.E010`` *in Django 3.1*.
* **postgres.W004**: Base field for array has warnings: ...

.. _contrib-app-checks-sites:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Flagging this – wanted to link here, but not sure about the naming.

docs/topics/checks.txt Outdated Show resolved Hide resolved
@marcgibbons marcgibbons marked this pull request as ready for review October 23, 2023 16:06
@felixxm felixxm changed the title Documentation: integration test examples for the system checks framework Doc'd writing integration tests for the system check framework. Oct 27, 2023
@felixxm felixxm force-pushed the system-checks-integration-testing branch from 8e13bcd to 8d9c0e4 Compare October 27, 2023 07:45
@felixxm
Copy link
Member

felixxm commented Oct 27, 2023

@marcgibbons Thanks 👍 I pushed small edits.

@felixxm felixxm merged commit 8d9c0e4 into django:main Oct 27, 2023
21 checks passed
@marcgibbons marcgibbons deleted the system-checks-integration-testing branch October 28, 2023 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants