Created
April 26, 2019 07:34
-
-
Save graffic/4873112c02914f5f8717296bcbf8d86a to your computer and use it in GitHub Desktop.
Django tests show SQL queries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.test import TestCase | |
class TestSomething(TestCase): | |
def setUp(self): | |
from django.conf import settings | |
settings.DEBUG=True | |
def test_something(self): | |
pass | |
def tearDown(self): | |
from django.db import connection | |
for query in connection.queries: | |
print(f"✅ {query['sql']}\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment