# Testing unmanaged models - a cleaner approach

**URL:** <https://forum.djangoproject.com/t/testing-unmanaged-models-a-cleaner-approach/27021>\
**Category:** Show & Tell\
**Created:** [January 17, 2024, 12:38am UTC](https://forum.djangoproject.com/t/testing-unmanaged-models-a-cleaner-approach/27021 "2024-01-17T00:38:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TobeTek](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/tobetek/32/18426_2.png) [@TobeTek](https://forum.djangoproject.com/u/TobeTek)\
**Post date:** [January 17, 2024, 12:38am UTC](https://forum.djangoproject.com/t/testing-unmanaged-models-a-cleaner-approach/27021/1 "2024-01-17T00:38:56Z")

</div>

TL;DR: Instead of monkey-patching the Django TestSuiteRunner to treat unmanaged models as managed, we instead manually create the tables during test-time using the SchemaEditor.

I wrote a blog post explaining my approach: [Unit-Testing Unmanaged Models — Django | by Emmanuel Katchy | Dev Genius](https://blog.devgenius.io/unit-testing-unmanaged-models-django-93648b5e6e24)

Happy to get comments and corrections. Thanks!
