# Unit test the equivalent of manage.py "system checks"

**URL:** <https://forum.djangoproject.com/t/unit-test-the-equivalent-of-manage-py-system-checks/21014>\
**Category:** Forms & APIs\
**Created:** [May 18, 2023, 4:50pm UTC](https://forum.djangoproject.com/t/unit-test-the-equivalent-of-manage-py-system-checks/21014 "2023-05-18T16:50:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnthagen](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/johnthagen/32/2774_2.png) [@johnthagen](https://forum.djangoproject.com/u/johnthagen)\
**Post date:** [May 18, 2023, 4:50pm UTC](https://forum.djangoproject.com/t/unit-test-the-equivalent-of-manage-py-system-checks/21014/1 "2023-05-18T16:50:31Z")

</div>

When starting up Django using the default `manage.py runserver` it performs system checks:

```auto
Performing system checks...

Watching for file changes with StatReloader
System check identified no issues (0 silenced).
May 18, 2023 - 16:48:17
Django version 4.1.9, using settings 'config.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

```

Is there anyway to run the equivalent to these checks, but using a test runner such as `pytest` so that CI would fail if any of these system checks would have failed?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 18, 2023, 5:29pm UTC](https://forum.djangoproject.com/t/unit-test-the-equivalent-of-manage-py-system-checks/21014/2 "2023-05-18T17:29:13Z")

</div>

It looks like both `runserver` and `check` run the `check` method in `django.core.management.base.BaseCommand`, which looks to me to use `django.core.checks`.

My guess would be that you could do the same thing.

See [System check framework | Django documentation | Django](https://docs.djangoproject.com/en/4.2/topics/checks/) and [System check framework | Django documentation | Django](https://docs.djangoproject.com/en/4.2/ref/checks/)

---

<div class="post-metadata">

**Author:** ![johnthagen](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/johnthagen/32/2774_2.png) [@johnthagen](https://forum.djangoproject.com/u/johnthagen)\
**Post date:** [May 18, 2023, 5:42pm UTC](https://forum.djangoproject.com/t/unit-test-the-equivalent-of-manage-py-system-checks/21014/3 "2023-05-18T17:42:43Z")

</div>

I also just learned that you can run:

```auto
python manage.py check --settings config.settings --fail-level DEBUG --verbosity 3

```

- [System check framework | Django documentation | Django](https://docs.djangoproject.com/en/4.2/topics/checks/#module-django.core.checks)

This is probably preferred since it’s documented and `manage.py` presumably has all of the settings and other things needed.

I’ll probably add this to my `noxfile.py` to run just before `pytest` is invoked.
