Bird
0
0

Which scope is the default for an autouse fixture if not specified?

easy🧠 Conceptual Q2 of 15
PyTest - Fixtures
Which scope is the default for an autouse fixture if not specified?
Afunction
Bmodule
Csession
Dclass
Step-by-Step Solution
Solution:
  1. Step 1: Recall default fixture scope

    By default, pytest fixtures have a scope of 'function', meaning they run once per test function.
  2. Step 2: Understand autouse does not change default scope

    Setting autouse=True does not change the default scope unless explicitly specified.
  3. Final Answer:

    function -> Option A
  4. Quick Check:

    Default fixture scope = function [OK]
Quick Trick: Default fixture scope is function unless changed [OK]
Common Mistakes:
MISTAKES
  • Assuming autouse changes default scope
  • Confusing session or module as default
  • Forgetting scope defaults to function

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes