python - py.test and fixtures - how to choose only one variant of params -


let's have following fixtures:

@pytest.fixture(params=['google.com','other-provider.com') def smtp_server(request):     .... initialisation ....     return smtpserver(request.param)   @pytest.fixture(params=['plain_text','html') def message(request):     .... initialisation according email type....     return msg_obj 

so if use them in 1 test function, have combination: google+plain, provider+plain, google+html, provider+html.

but if want reuse fixtures, in specific combination. eg noticed when send html email google, fails under circumstances. how can reuse fixtures , test situation, without testing sending other-provider.com, pointless?

in other words - how skip combination of fixtures in specific test function?

firstly i'd point out odd case. sure tests not meaningful @ combinations want skip?

having said way have solved myself use

if snmtp_server == 'other-provider.com' , message == 'html':     pytest.skip('impossible combination') 

inside test function. it's rudimentary works enough unusual , rare case.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -