xfail = pytest.mark.xfail @xfail def test_func1(): pass @xfail(reason="123") def test_func2(): pass where previously test_func1 and test_func2 would wrongly share the same reason because the xfail object was modified in place.