文中写的是
$ pytest tests/test-function/test_parametrize.py
============================= test session starts =============================
platform win32 -- Python 3.6.4, pytest-3.6.1, py-1.5.2, pluggy-0.6.0
rootdir: F:\self-repo\learning-pytest, inifile:
collected 3 items
tests\test-function\test_parametrize.py F.. [100%]
================================== FAILURES ===================================
但根据代码实际运行的结果是
================================================================================================================= test session starts =================================================================================================================
platform win32 -- Python 3.7.10, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: C:\Users\w00611915\PycharmProjects\learn_pytest
collected 3 items
test_parametrize.py F.. [100%]
====================================================================================================================== FAILURES =======================================================================================================================
_____________________________________________________________________________________________________________ test_passwd_length[123456] ______________________________________________________________________________________________________________
passwd = '123456'
@pytest.mark.parametrize('passwd',
['123456',
'abcdefdfs',
'as52345fasdf4'])
def test_passwd_length(passwd):
E AssertionError: assert 6 >= 8
E + where 6 = len('123456')
test_parametrize.py:8: AssertionError
=============================================================================================================== short test summary info ===============================================================================================================
FAILED test_parametrize.py::test_passwd_length[123456] - AssertionError: assert 6 >= 8
============================================================================================================= 1 failed, 2 passed in 0.05s =============================================================================================================
文中写的是
$ pytest tests/test-function/test_parametrize.py
============================= test session starts =============================
platform win32 -- Python 3.6.4, pytest-3.6.1, py-1.5.2, pluggy-0.6.0
rootdir: F:\self-repo\learning-pytest, inifile:
collected 3 items
tests\test-function\test_parametrize.py F.. [100%]
================================== FAILURES ===================================
但根据代码实际运行的结果是
================================================================================================================= test session starts =================================================================================================================
platform win32 -- Python 3.7.10, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: C:\Users\w00611915\PycharmProjects\learn_pytest
collected 3 items
test_parametrize.py F.. [100%]
====================================================================================================================== FAILURES =======================================================================================================================
_____________________________________________________________________________________________________________ test_passwd_length[123456] ______________________________________________________________________________________________________________
passwd = '123456'
E AssertionError: assert 6 >= 8
E + where 6 = len('123456')
test_parametrize.py:8: AssertionError
=============================================================================================================== short test summary info ===============================================================================================================
FAILED test_parametrize.py::test_passwd_length[123456] - AssertionError: assert 6 >= 8
============================================================================================================= 1 failed, 2 passed in 0.05s =============================================================================================================