How do you skip tests in PyTest?

Beginner

Answer

PyTest provides several ways to skip tests:

import pytest
@pytest.mark.skip(reason="Not implemented yet")
def test_feature():
    pass
@pytest.mark.skipif(sys.version_info < (3, 8), reason="Requires Python 3.8+")
def test_walrus_operator():
    pass
def test_conditional_skip():
    if not has_database_connection():
        pytest.skip("Database not available")