Pytestユニットテストシリーズ[v 1.0.0][pytest-emoji]

34482 ワード

pytest-emoji:Add Some Fun to Your Tests
コマンドpip install pytest-emojiインストールプラグインの実行
E:\Programs\Python\Python_Pytest\TestScripts>pip install pytest-emoji
Collecting pytest-emoji
  Downloading https://files.pythonhosted.org/packages/f7/51/80af966c0aded877da7577d21c4601ca98c6f603c6e6073ddea071af01ec/pytest_emoji-0.2.0-py3-none-any.whl
Requirement already satisfied: pytest>=4.2.1 in c:\python37\lib\site-packages (from pytest-emoji) (4.5.0)
Requirement already satisfied: attrs>=17.4.0 in c:\python37\lib\site-packages (from pytest>=4.2.1->pytest-emoji) (19.1.0)
Requirement already satisfied: pluggy!=0.10,<1.0,>=0.9 in c:\python37\lib\site-packages (from pytest>=4.2.1->pytest-emoji) (0.11.0)
Requirement already satisfied: six>=1.10.0 in c:\python37\lib\site-packages (from pytest>=4.2.1->pytest-emoji) (1.12.0)
Requirement already satisfied: wcwidth in c:\python37\lib\site-packages (from pytest>=4.2.1->pytest-emoji) (0.1.7)
Requirement already satisfied: py>=1.5.0 in c:\python37\lib\site-packages (from pytest>=4.2.1->pytest-emoji) (1.8.0)
Requirement already satisfied: colorama; sys_platform == "win32" in c:\python37\lib\site-packages (from pytest>=4.2.1->pytest-emoji) (0.4.1)
Requirement already satisfied: more-itertools>=4.0.0; python_version > "2.7" in c:\python37\lib\site-packages (from pytest>=4.2.1->pytest-emoji) (7.0.0)
Requirement already satisfied: setuptools in c:\users\davieyang\appdata\roaming\python\python37\site-packages (from pytest>=4.2.1->pytest-emoji) (41.0.1)
Requirement already satisfied: atomicwrites>=1.0 in c:\python37\lib\site-packages (from pytest>=4.2.1->pytest-emoji) (1.3.0)
Installing collected packages: pytest-emoji
Successfully installed pytest-emoji-0.2.0

それぞれ3つの方法でテストを実行し、テスト結果を比較して–emojiの効果を見る
E:\Programs\Python\Python_Pytest\TestScripts>pytest --tb=no
==================== test session starts ===============================
platform win32 -- Python 3.7.3, pytest-4.5.0, py-1.8.0, pluggy-0.11.0
rootdir: E:\Programs\Python\Python_Pytest\TestScripts
plugins: xdist-1.29.0, timeout-1.3.3, repeat-0.8.0, instafail-0.4.1, forked-1.0.2, emoji-0.2.0, allure-pytest-2.6.3
collected 17 items                                                                                                                                                         

test_asserts.py ...F..F                                                                                                                                              [ 41%]
test_fixture1.py ..                                                                                                                                                  [ 52%]
test_fixture2.py ..                                                                                                                                                  [ 64%]
test_one.py .F                                                                                                                                                       [ 76%]
test_two.py ....                                                                                                                                                     [100%]

============ 3 failed, 14 passed, 1 warnings in 0.31 seconds ================

E:\Programs\Python\Python_Pytest\TestScripts>pytest --tb=no -v
======================== test session starts ==========================
platform win32 -- Python 3.7.3, pytest-4.5.0, py-1.8.0, pluggy-0.11.0 -- c:\python37\python.exe
cachedir: .pytest_cache
rootdir: E:\Programs\Python\Python_Pytest\TestScripts
plugins: xdist-1.29.0, timeout-1.3.3, repeat-0.8.0, instafail-0.4.1, forked-1.0.2, emoji-0.2.0, allure-pytest-2.6.3
collected 17 items                                                                                                                                                         

test_asserts.py::test_add PASSED                                                                                                                                     [  5%]
test_asserts.py::test_add2 PASSED                                                                                                                                    [ 11%]
test_asserts.py::test_add3 PASSED                                                                                                                                    [ 17%]
test_asserts.py::test_add4 FAILED                                                                                                                                    [ 23%]
test_asserts.py::test_in PASSED                                                                                                                                      [ 29%]
test_asserts.py::test_not_in PASSED                                                                                                                                  [ 35%]
test_asserts.py::test_true FAILED                                                                                                                                    [ 41%]
test_fixture1.py::test_numbers_3_4 PASSED                                                                                                                            [ 47%]
test_fixture1.py::test_strings_a_3 PASSED                                                                                                                            [ 52%]
test_fixture2.py::TestUM::test_numbers_5_6 PASSED                                                                                                                    [ 58%]
test_fixture2.py::TestUM::test_strings_b_2 PASSED                                                                                                                    [ 64%]
test_one.py::test_equal PASSED                                                                                                                                       [ 70%]
test_one.py::test_not_equal FAILED                                                                                                                                   [ 76%]
test_two.py::test_default PASSED                                                                                                                                     [ 82%]
test_two.py::test_member_access PASSED                                                                                                                               [ 88%]
test_two.py::test_asdict PASSED                                                                                                                                      [ 94%]
test_two.py::test_replace PASSED                                                                                                                                     [100%]
=============== 3 failed, 14 passed, 1 warnings in 0.37 seconds ==============

E:\Programs\Python\Python_Pytest\TestScripts>pytest --tb=no --emoji
=============== test session starts ========================
platform win32 -- Python 3.7.3, pytest-4.5.0, py-1.8.0, pluggy-0.11.0
rootdir: E:\Programs\Python\Python_Pytest\TestScripts
plugins: xdist-1.29.0, timeout-1.3.3, repeat-0.8.0, instafail-0.4.1, forked-1.0.2, emoji-0.2.0, allure-pytest-2.6.3
collected 17 items                                                                                                                                                         

test_asserts.py ? ? ? ? ? ? ? 
       [ 41%]
test_fixture1.py ? ?                                                                                                                                               [ 5
2%]
test_fixture2.py ? ?                                                                                                                                               [ 6
4%]
test_one.py ? ?                                                                                                                                                    [ 7
6%]
test_two.py ? ? ? ? 
 [100%]
========== 3 failed, 14 passed, 1 warnings in 0.32 seconds =================