Ejemplo n.º 1
0
def test_pytest_mark_getattr():
    from py.__.test.outcome import mark
    def f(): pass

    mark.hello(f)
    assert f.hello == True

    mark.hello("test")(f)
    assert f.hello == "test"

    py.test.raises(AttributeError, "mark._hello")
    py.test.raises(AttributeError, "mark.__str__")
Ejemplo n.º 2
0
def test_pytest_mark_call():
    from py.__.test.outcome import mark
    def f(): pass
    mark(x=3)(f)
    assert f.x == 3
    def g(): pass
    mark(g)
    assert not g.func_dict

    mark.hello(f)
    assert f.hello == True

    mark.hello("test")(f)
    assert f.hello == "test"

    mark("x1")(f)
    assert f.mark == "x1"