如何解决Pytest:最后的输出减少了?
我通过 PyCharm 执行 pytest。
输出的底部如下所示:
=================================== FAILURES ===================================
__________________ test_get_landing_page_breadcrumb_for_foos ___________________
@pytest.mark.django_db
def test_get_landing_page_breadcrumb_for_foos():
location = Location.objects.create(canonical_name='test-location',name='Test Location',search_volume=1000)
term = Term.objects.create(canonical_name='test-term',name='Test Term',search_volume=1500)
> assert 0,get_landing_page_breadcrumb_for_foos(location.canonical_name,term.canonical_name,PortalFactory.build())
E AssertionError: [{'@context': 'http://schema.org','@type': 'BreadcrumbList','itemListElement': [{'@type': 'ListItem','item': 'https.../test-location/','name': 'test-location','position': 2},{'@type': 'ListItem','name': 'test-term','position': 3}]}]
E assert 0
test_search_pages.py:12: AssertionError
---------------------------- Captured stdout setup -----------------------------
Operations to perform:
Synchronize unmigrated apps: admin_ordering,company_search,compressor,corsheaders,debug_toolbar,django_countries,django_extensions,...
Apply all migrations: admin,auth,cms,contenttypes,....
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Running migrations:
No migrations to apply.
Cache table 'file_resubmit_cache' already exists.
---------------------------- Captured stderr setup -----------------------------
Using existing test database for alias 'default' ('test_foofirm')...
=========================== short test summary info ============================
FAILED test_search_pages.py::test_get_landing_page_breadcrumb_for_foos - Asse...
============================== 1 failed in 4.42s ===============================
Process finished with exit code 1
Assertion failed
Assertion failed
我想减少最后的输出,因为我使用“滚动到结尾”来查看重要的行。
我希望输出的结尾看起来像这样:
=================================== FAILURES ===================================
__________________ test_get_landing_page_breadcrumb_for_foos ___________________
@pytest.mark.django_db
def test_get_landing_page_breadcrumb_for_foos():
location = Location.objects.create(canonical_name='test-location','position': 3}]}]
E assert 0
test_search_pages.py:12: AssertionError
有时“捕获的标准输出”很重要。但我不认为处于底部。有没有办法将“捕获的标准输出”移到“失败”上方?
---------------------------- Captured stdout setup -----------------------------
Operations to perform:
Synchronize unmigrated apps: admin_ordering,....
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Running migrations:
No migrations to apply.
Cache table 'file_resubmit_cache' already exists.
---------------------------- Captured stderr setup -----------------------------
Using existing test database for alias 'default' ('test_foofirm')...
=========================== short test summary info ============================
FAILED test_search_pages.py::test_get_landing_page_breadcrumb_for_foos - Asse...
============================== 1 failed in 4.42s ===============================
Process finished with exit code 1
Assertion failed
Assertion failed
解决方法
您似乎想进一步了解 Pytest 中的 verbose command
如果您希望输出不那么冗长,请尝试 pytest -q
或 pytest --quiet
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。