Bird
0
0

Which of the following is the correct way to name a pytest test file?

easy📝 Syntax Q12 of 15
PyTest - Test Organization
Which of the following is the correct way to name a pytest test file?
ATestExample.py
Bexampletest.py
Cexample.py
Dtest_example.py
Step-by-Step Solution
Solution:
  1. Step 1: Recall pytest naming conventions

    Pytest requires test files to start with 'test_' or end with '_test.py'.
  2. Step 2: Check options against convention

    Only 'test_example.py' starts with 'test_' and follows lowercase naming.
  3. Final Answer:

    test_example.py -> Option D
  4. Quick Check:

    File name starts with 'test_' [OK]
Quick Trick: Test files start with 'test_' prefix [OK]
Common Mistakes:
MISTAKES
  • Using uppercase letters in test file names
  • Not starting file name with 'test_'
  • Naming files without 'test' keyword

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes