G
G
german_mel2021-09-23 16:08:02
Python
german_mel, 2021-09-23 16:08:02

How to add mark.xfail to @pytest.mark.parametrize('link', urls) parameterization?

I run the test with @pytest.mark.parametrize('link', urls) parameterization, where urls is a variable containing a list of n urls for tests. There is a bug in one of the urls, please tell me how can I mark one url from the list as xfail?

I saw in the documentation and in the examples that in the parameterization they explicitly list all addresses with a list and one mark xfail, I try to understand whether it is possible to use xfail in the case of a variable.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
german_mel, 2021-09-23
@german_mel

It seems to have figured it out, but I'll be happy with a more competent solution.
urls[x] = pytest.param(urls[x], marks=pytest.mark.xfail), where x is the index of the desired list element

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question