如果您运行“./manage.py test -v 2”,您通常可以看到在运行测试之前应用的所有迁移。
使用 pytest-django,无论我添加多少 -v,它都不会显示任何有关迁移的信息。
有没有我看不到的魔法旗让它这样做?
顺便感谢您提供的出色插件
确保不要使用--reuse-db
/ --nomigrations
。
好吧,即使不使用它们,它仍然没有向我显示任何内容,即使是最大程度的冗长。
这是运行“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
这是运行“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
该项目中的pytest.ini中没有任何内容。
这不应该发生吗?
这些是我的 pytest 库:
谢谢
我检查了一下,迁移实际上是正确执行的,问题只是它没有显示任何内容。
哦,你还必须使用-s
。
啊好的,非常感谢,那么一切都很好
最有用的评论
哦,你还必须使用
-s
。