Bird
0
0

Which of the following directories will pytest search for tests by default?

easy🧠 Conceptual Q1 of 15
PyTest - Test Organization
Which of the following directories will pytest search for tests by default?
AAny directory containing a file named 'setup.py'
BDirectories named 'test' or 'tests' in the current folder
COnly the root directory of the project
DDirectories named 'src' or 'lib'
Step-by-Step Solution
Solution:
  1. Step 1: Understand pytest default directory search

    pytest looks for directories named 'test' or 'tests' to find test files.
  2. Step 2: Eliminate other directory options

    Directories like 'src', 'lib', or those with 'setup.py' are not searched by default.
  3. Final Answer:

    Directories named 'test' or 'tests' in the current folder -> Option B
  4. Quick Check:

    Default test directories = 'test' or 'tests' [OK]
Quick Trick: pytest looks in 'test' or 'tests' folders by default [OK]
Common Mistakes:
MISTAKES
  • Assuming pytest searches all folders
  • Thinking 'src' or 'lib' are default test folders
  • Confusing 'setup.py' presence with test discovery

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes