0
0
PyTesttesting~10 mins

@pytest.mark.skip with reason - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to skip the test with a reason.

PyTest
import pytest

@pytest.mark.skip(reason=[1])
def test_example():
    assert 1 == 1
Drag options to blanks, or click blank then click option'
ANone
BTrue
CFalse
D"Not implemented yet"
Attempts:
3 left
💡 Hint
Common Mistakes
Using True or False instead of a string as reason.
Leaving reason empty or None.
2fill in blank
medium

Complete the code to skip the test with a reason explaining it's broken.

PyTest
import pytest

@pytest.mark.skip(reason=[1])
def test_broken_feature():
    assert False
Drag options to blanks, or click blank then click option'
A"Feature is broken"
BFalse
CNone
DTrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using boolean values instead of a string.
Not providing any reason.
3fill in blank
hard

Fix the error in the skip decorator by completing the reason argument correctly.

PyTest
import pytest

@pytest.mark.skip(reason=[1])
def test_skip_fix():
    assert True
Drag options to blanks, or click blank then click option'
A123
B"Fix pending"
CTrue
DNone
Attempts:
3 left
💡 Hint
Common Mistakes
Using numbers or booleans instead of strings.
Omitting quotes around the reason.
4fill in blank
hard

Fill both blanks to skip the test with a reason and add a simple assertion.

PyTest
import pytest

@pytest.mark.skip(reason=[1])
def test_skip_and_assert():
    assert [2]
Drag options to blanks, or click blank then click option'
A"Waiting for bug fix"
BTrue
CFalse
D"No reason"
Attempts:
3 left
💡 Hint
Common Mistakes
Using False in assertion which fails the test.
Using non-string for reason.
5fill in blank
hard

Fill all three blanks to skip the test with a reason, assert a condition, and add a print statement.

PyTest
import pytest

@pytest.mark.skip(reason=[1])
def test_full_example():
    assert [2]
    print([3])
Drag options to blanks, or click blank then click option'
A"Feature not ready"
BTrue
C"Test skipped"
DFalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using False in assertion causing failure.
Not using quotes for string values.