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

参数化部分,测试结果错误 #2

Open
wuchenxi118 opened this issue Jul 22, 2021 · 0 comments
Open

参数化部分,测试结果错误 #2

wuchenxi118 opened this issue Jul 22, 2021 · 0 comments

Comments

@wuchenxi118
Copy link

文中写的是
$ 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):
  assert len(passwd) >= 8

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 =============================================================================================================

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

1 participant