Bird
0
0

What is the default behavior of pytest when it discovers multiple test modules in a directory?

medium Q2 of 15
PyTest - Test Organization
What is the default behavior of pytest when it discovers multiple test modules in a directory?
AIt runs tests only in the first module alphabetically
BIt asks the user to select which module to run
CIt runs tests in all modules matching the naming pattern
DIt ignores all modules except those explicitly imported
Step-by-Step Solution
Solution:
  1. Step 1: Recall pytest's test discovery process

    pytest automatically finds and runs all test modules matching its naming conventions in the current directory and subdirectories.
  2. Step 2: Understand how pytest handles multiple modules

    pytest runs tests in all discovered modules without user intervention or ignoring any unless specified.
  3. Final Answer:

    It runs tests in all modules matching the naming pattern -> Option C
  4. Quick Check:

    pytest runs all matching test modules by default [OK]

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes