Bird
0
0

What is wrong with this pytest marker usage?

medium📝 Debug Q7 of 15
Selenium Python - Test Framework Integration (pytest)
What is wrong with this pytest marker usage?
import pytest

@pytest.mark('slow')
def test_example():
    assert True
AMarkers must be used as attributes, not called as functions
BThe marker name must be uppercase
CThe test function must return a value
DThe assert statement is missing a message
Step-by-Step Solution
Solution:
  1. Step 1: Understand correct marker usage

    Markers are attributes, not functions, so no parentheses.
  2. Step 2: Identify the syntax error

    @pytest.mark('slow') incorrectly calls mark as a function.
  3. Final Answer:

    Markers must be used as attributes, not called as functions -> Option A
  4. Quick Check:

    Markers as attributes not func calls = A [OK]
Quick Trick: Markers are attributes, not function calls [OK]
Common Mistakes:
  • Using parentheses with markers
  • Assuming marker names must be uppercase
  • Expecting test functions to return values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes