Pytest Intermediate Quiz
Explore parametrization, markers, mocking, plugins, and test organization
Start the quizSample questions from this quiz
A preview of the style and depth. Try each one, then reveal the answer — or skip straight to the timed quiz.
1. What is parametrize?
- Parameter decorator
- Runs test with multiple input sets
- Data-driven testing
- Test generator
Show answer
Answer: Runs test with multiple input sets. @pytest.mark.parametrize runs test with different inputs. Creates separate test per input set. Clear reporting per case. Essential for data-driven testing.
2. How do you use parametrize?
- @pytest.mark.parametrize('args', [values])
- @params([values])
- pytest.param(values)
- @parametrize(values)
Show answer
Answer: @pytest.mark.parametrize('args', [values]). @pytest.mark.parametrize("x,y,expected", [(1,2,3), (2,3,5)]). First arg is parameter names, second is value tuples. Multiple parameters comma-separated.
3. What are fixture scopes?
- unit, integration
- function, class, module, package, session
- test, file, suite
- local, global
Show answer
Answer: function, class, module, package, session. Fixture scopes: function (default), class, module, package, session. Determines when fixture is setup/torn down. Broader scope = shared across more tests.
Frequently asked questions
How many questions are in this Pytest quiz?+
30 questions, with a 60-minute time limit. Every question includes a written explanation of the correct answer.
Is this Pytest quiz free?+
Yes. Every quiz on CodexQuizz is free and needs no account. You only enter a name if you choose to post your score to the leaderboard.
What level is the intermediate quiz aimed at?+
Explore parametrization, markers, mocking, plugins, and test organization
Can I use this to prepare for a Pytest interview?+
Yes. The questions cover the topics that come up in Pytest technical screens, and the explanations are written so that a wrong answer still teaches you the underlying concept.
Ready to test your Pytest?
30 questions, 60 minutes. Free, no sign-up.
Start now