Bird
0
0

What is the default way PyTest identifies a test file?

easy🧠 Conceptual Q1 of 15
PyTest - Basics and Setup
What is the default way PyTest identifies a test file?
AFile name contains 'pytest' anywhere
BFile name starts with 'test_' or ends with '_test.py'
CFile name is exactly 'test.py'
DFile name ends with '.pytest'
Step-by-Step Solution
Solution:
  1. Step 1: Understand PyTest file naming conventions

    PyTest looks for files starting with 'test_' or ending with '_test.py' to find tests.
  2. Step 2: Compare options with PyTest rules

    Only File name starts with 'test_' or ends with '_test.py' matches the official PyTest file naming pattern.
  3. Final Answer:

    File name starts with 'test_' or ends with '_test.py' -> Option B
  4. Quick Check:

    PyTest test file naming = File name starts with 'test_' or ends with '_test.py' [OK]
Quick Trick: Test files start with 'test_' or end with '_test.py' [OK]
Common Mistakes:
MISTAKES
  • Assuming any .py file is a test file
  • Thinking file must be named exactly 'test.py'
  • Confusing file name patterns with function names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes