Bird
0
0

Find the issue in this pytest code snippet:

medium📝 Debug Q6 of 15
PyTest - Markers
Find the issue in this pytest code snippet:
import pytest

@pytest.mark.skip(reason=NotReady)
def test_func():
    assert True
AThe reason argument should be a string in quotes
BThe decorator @pytest.mark.skip is invalid
CThe test function must have parameters
Dassert True is incorrect syntax
Step-by-Step Solution
Solution:
  1. Step 1: Check reason argument

    The reason must be a string literal, e.g., "NotReady".
  2. Step 2: Identify error

    Here, NotReady is used without quotes, causing a NameError.
  3. Final Answer:

    The reason argument should be a string in quotes -> Option A
  4. Quick Check:

    Reason must be a quoted string [OK]
Quick Trick: Reason must be a quoted string [OK]
Common Mistakes:
MISTAKES
  • Passing unquoted identifiers as reason
  • Misusing decorator syntax
  • Assuming reason is optional

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes