I would like to run the tests in my Django project, displaying the test names, but without displaying the logging output of the database migrations.
If I do not pass the -v 2
flag, then I don’t get to see the test names, which I want to see:
$ python manage.py run test
Found 1 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
.
----------------------------------------------------------------------
Ran 1 test in 0.053s
OK
Destroying test database for alias 'default'...
However, if I pass the flag -v 2
to increase the verbosity level, then I see both the test names and the logging information from the database migrations:
$ python manage.py test -v 2
Found 1 test(s).
Creating test database for alias 'default' ('test_projectname')...
Operations to perform:
Synchronize unmigrated apps: allauth, django_browser_reload, django_extensions, forms, google, hijack, hijack_admin, messages, runserver_nostatic, simple_deploy, staticfiles
Apply all migrations: account, admin, auth, contenttypes, sessions, sites, socialaccount
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Running migrations:
Applying contenttypes.0001_initial... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0001_initial... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
# ... cut for brevity
System check identified no issues (0 silenced).
test_hello (projectname.test_login.LoginTest.test_hello) ... ok
----------------------------------------------------------------------
Ran 1 test in 0.046s
OK
Destroying test database for alias 'default' ('test_projectname')...
How do I display just the test names, without displaying all this additional logging information?