Pytest-django: Seeing migrations running during tests

Created on 22 Feb 2017  路  5Comments  路  Source: pytest-dev/pytest-django

If you run "./manage.py test -v 2" you can normally see all the migrations that get applied before running the tests.

With pytest-django no matter how much -v I add it never shows anything about migrations.
Is there a magic flag I could not see to make it do that?
Thanks for the great plugin by the way

Most helpful comment

Oh, you have to use -s also..

All 5 comments

Make sure to not use --reuse-db / --nomigrations.

Well even not using them it still doesn't show anything to me, even with maximum verbosity.
This is running "manage.py test -v2":

Creating test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...
Operations to perform:
  Synchronize unmigrated apps: messages, raven_contrib_django, staticfiles
  Apply all migrations: admin, auth, contenttypes, sessions, token_renewal
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
Running migrations:
  Applying contenttypes.0001_initial... OK

And this is running "pytest -vvv":

platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.31, pluggy-0.4.0 -- /home/andrea/.virtualenvs/iwoca-xero/bin/python3.5
cachedir: .cache
Django settings: iwoca_xero.settings.test (from ini file)
rootdir: /home/andrea/code/iwoca-xero, inifile: pytest.ini
plugins: django-3.1.2, cov-2.4.0
collected 11 items 

iwoca_xero/core/tests/test_middleware.py::test_that_an_exception_raised_in_a_view_is_logged PASSED
iwoca_xero/core/tests/test_middleware.py::test_that_an_http_response_error_content_is_logged PASSED
iwoca_xero/token_renewal/tests/test_logic.py::test_no_token_found PASSED
iwoca_xero/token_renewal/tests/test_logic.py::test_token_not_expired PASSED
iwoca_xero/token_renewal/tests/test_logic.py::test_token_expired PASSED

With nothing in the pytest.ini in that project.

Is that not supposed to happen?

These are my pytest libraries:

  • pytest==3.0.6
  • pytest-cache==1.0
  • pytest-cov==2.4.0
  • pytest-django==3.1.2

Thanks

I checked and the migrations are actually correctly executed anyway, the problem is just that it doesn't show anything.

Oh, you have to use -s also..

Ah ok great thanks, all good then

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rlskoeser picture rlskoeser  路  7Comments

tolomea picture tolomea  路  4Comments

scherrey picture scherrey  路  6Comments

WoLpH picture WoLpH  路  7Comments

mjk4 picture mjk4  路  4Comments