Bird
0
0

If a test function is named 'check_login', will pytest discover and run it by default?

medium📝 Predict Output Q5 of 15
PyTest - Test Organization
If a test function is named 'check_login', will pytest discover and run it by default?
AYes, all functions with 'check' are discovered
BNo, because it does not start with 'test'
CYes, if the file name starts with 'test_'
DNo, unless marked with @pytest.mark.test
Step-by-Step Solution
Solution:
  1. Step 1: Understand pytest function discovery

    pytest discovers functions starting with 'test' by default.
  2. Step 2: Analyze 'check_login'

    Function name does not start with 'test', so it is not discovered.
  3. Final Answer:

    No, because it does not start with 'test' -> Option B
  4. Quick Check:

    Function must start with 'test' to be discovered [OK]
Quick Trick: Function names must start with 'test' to run by default [OK]
Common Mistakes:
MISTAKES
  • Assuming 'check_' prefix is recognized
  • Thinking file name alone triggers discovery
  • Believing decorators are needed for default discovery

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes