Bird
0
0

If a test module named test_math.py contains a syntax error, what will pytest do when running tests?

medium Q5 of 15
PyTest - Test Organization
If a test module named test_math.py contains a syntax error, what will pytest do when running tests?
Apytest will run other test modules but report the syntax error
Bpytest will report an error and stop running tests
Cpytest will skip the module silently
Dpytest will ignore the syntax error and run tests anyway
Step-by-Step Solution
Solution:
  1. Step 1: Understand pytest's error handling during test discovery

    If a test module has a syntax error, pytest cannot import it and will report the error.
  2. Step 2: Check pytest behavior with multiple modules

    pytest continues running tests in other modules but reports the syntax error for the faulty module.
  3. Final Answer:

    pytest will run other test modules but report the syntax error -> Option A
  4. Quick Check:

    pytest reports syntax errors but runs other tests [OK]

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes