Source From Here
QuestionLet's say I have a bunch of tests:
- def test_func_one():
- ...
- def test_func_two():
- ...
- def test_func_three():
- ...
- @pytest.disable()
- def test_func_one():
- ...
- def test_func_two():
- ...
- def test_func_three():
- ...
Pytest has the skip and skipif decorators, similar to the Python unittest module (which uses skip and skipIf), which can be found in the documentation here.
Examples from the link can be found here:
- @pytest.mark.skip(reason="no way of currently testing this")
- def test_the_unknown():
- ...
- import sys
- @pytest.mark.skipif(sys.version_info < (3,3),
- reason="requires python3.3")
- def test_function():
- ...
沒有留言:
張貼留言