---
title: "Discussion on \"How to Use Fixtures as Arguments in pytest.mark.parametrize\" | Hashnode"
description: "Discussion on \"How to Use Fixtures as Arguments in pytest.mark.parametrize\". Learn how to use pytest mark parametrize with fixtures"
url: "https://hashnode.com/posts/how-to-use-fixtures-as-arguments-in-pytestmarkparametrize/5fb8ef570ae19203f6d92a80"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to Use Fixtures as Arguments in pytest.mark.parametrize](https://miguendes.me/how-to-use-fixtures-as-arguments-in-pytestmarkparametrize?utm_source=hashnode&utm_medium=feed)

Learn how to use pytest mark parametrize with fixtures

Nov 21, 2020 · 4 min read · miguendes.me  
Updated Jan 21, 2022  
Read the article

-   [#python](https://hashnode.com/tag/python)
-   [#pytest](https://hashnode.com/tag/pytest)
-   [#tutorial](https://hashnode.com/tag/tutorial)
-   [#100daysofcode](https://hashnode.com/tag/100daysofcode)

## Written by

[Miguel Brito](https://hashnode.com/@miguendes)

@miguendes · London, UK

  
[View profile](https://hashnode.com/@miguendes)

Machine Learning Software Engineer - Hobbyst Technical Writer - Interested in Software Testing, Best Practices, Scalability, and Python.

AI Software Engineer based in London, UK with 6+ years of professional experience developing and releasing software in different programming languages - Hobbyist Technical Writer - Interested in Software Testing, Best Practices, Scalability, Machine Learning/AI, and Python.

## Responses 1

Markdown supported · ⌘↵ to post

[Алексей Каллистов](https://hashnode.com/@mailakallistov)

[Jan 19, 2021](https://hashnode.com/posts/how-to-use-fixtures-as-arguments-in-pytestmarkparametrize/5fb8ef570ae19203f6d92a80/comment/6006b577b2c54030097c3f38)

Hello! And what could you suggest, if I need to use in parametrization a fixture, which returns unpredictable number of values? Of course, we could use it in parametrization as a regular Python function, but what if it's impossible? For example, this question is discussed here, but no solution was found: [github.com/pytest-dev/pytest/issues/349](https://github.com/pytest-dev/pytest/issues/349)

In my case, I definitely need a fixture and not a regular function, because parametrized value depends on HTTP service response.

Here is example code which matches my case: [pastebin.com/gLn1CrAa](https://pastebin.com/gLn1CrAa)

Of course, it doesn't work, because I'm trying to use fixture directly in mark.parametrize. Maybe, there is some suitable solution?

[Nima](https://hashnode.com/@nima994)

[Jul 1, 2021](https://hashnode.com/posts/how-to-use-fixtures-as-arguments-in-pytestmarkparametrize/5fb8ef570ae19203f6d92a80/comment/6006b577b2c54030097c3f38#reply-60dd8d2d95305075b93395b8)

You are right, this solution is not valid. It is just a complex way to do an easy task not the actual topic
