How to skip test case using PyTest?

 The simplest way to skip a test function is to mark it with the skip decorator which may be passed an optional reason:

@pytest.mark.skip(reason="this will not execute")
def mytest():
  ...

Alternatively, it is also possible to skip imperatively during test execution or setup by calling the pytest.skip(reason) function:

def my_function():
    if not valid_config():
        pytest.skip("unsupported configuration")