Beispiel #1
0
def test_bp_set_attribute_warning():
    bp = Blueprint("bp")
    message = (
        "Setting variables on Blueprint instances is not allowed. You should "
        "change your Blueprint instance to use instance.ctx.foo instead.")
    with pytest.raises(AttributeError, match=message):
        bp.foo = 1
Beispiel #2
0
def test_bp_set_attribute_warning():
    bp = Blueprint("bp")
    with pytest.warns(UserWarning) as record:
        bp.foo = 1

    assert len(record) == 1
    assert record[0].message.args[0] == (
        "Setting variables on Blueprint instances is deprecated "
        "and will be removed in version 21.9. You should change your "
        "Blueprint instance to use instance.ctx.foo instead.")