Bird
0
0

Given this pytest folder structure:

medium📝 Predict Output Q4 of 15
PyTest - Test Organization
Given this pytest folder structure:
tests/
  test_math.py
  utils/
    test_helpers.py

Which command runs all tests including helpers?
Apytest utils/
Bpytest tests/test_math.py
Cpytest test_helpers.py
Dpytest tests/
Step-by-Step Solution
Solution:
  1. Step 1: Understand pytest test discovery

    Running 'pytest tests/' runs all tests in 'tests' and its subfolders.
  2. Step 2: Check options

    pytest tests/ runs all tests; others run only parts or wrong paths.
  3. Final Answer:

    pytest tests/ -> Option D
  4. Quick Check:

    Run root test folder to include all tests [OK]
Quick Trick: Run pytest on root test folder to run all tests [OK]
Common Mistakes:
MISTAKES
  • Running only one test file misses others
  • Running subfolder without root misses some tests
  • Using wrong paths causes no tests to run

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes