Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seeing migrations running during tests #466

Closed
AndreaCrotti opened this issue Feb 22, 2017 · 5 comments
Closed

Seeing migrations running during tests #466

AndreaCrotti opened this issue Feb 22, 2017 · 5 comments

Comments

@AndreaCrotti
Copy link

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

@blueyed
Copy link
Contributor

blueyed commented Feb 22, 2017

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

@AndreaCrotti
Copy link
Author

AndreaCrotti commented Feb 22, 2017

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

@AndreaCrotti
Copy link
Author

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

@blueyed
Copy link
Contributor

blueyed commented Feb 22, 2017

Oh, you have to use -s also..

@AndreaCrotti
Copy link
Author

Ah ok great thanks, all good then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants