Complete the code to register a pytest marker named 'slow'.
import pytest def pytest_configure(config): config.[1]("slow", description="marks tests as slow")
The add_marker method is used to register a custom marker in pytest.
Complete the code to mark a test function with the 'slow' marker.
import pytest @pytest.[1]("slow") def test_example(): assert True
The @pytest.mark.slow decorator marks the test with the 'slow' marker.
Fix the error in the pytest marker registration function.
def pytest_configure(config): config.[1]("slow", description="marks slow tests")
The correct method to register a marker is add_marker. Using 'register_marker' causes an error.
Fill both blanks to register a marker and add a description.
def pytest_configure(config): config.[1]("performance", description=[2])
Use add_marker to register the marker and provide a descriptive string for the description.
Fill all three blanks to register a marker, mark a test, and check the marker in the test.
def pytest_configure(config): config.[1]("api", description="marks API tests") import pytest @pytest.[2]("api") def test_api_call(request): marker = request.node.get_closest_marker([3]) assert marker is not None
First, register the 'api' marker with add_marker. Then mark the test with @pytest.mark.api. Finally, check the marker by passing the string 'api' to get_closest_marker.