test_04_automark.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:pytest-dependency 作者: RKrahl 项目源码 文件源码
def test_set_false(ctestdir):
    """A pytest.ini is present, automark_dependency is set to false.

    Since automark_dependency is set to false and test_a is not
    marked, the outcome of test_a will not be recorded.  As a result,
    test_b will be skipped due to a missing dependency.
    """
    ctestdir.makefile('.ini', pytest="""
        [pytest]
        automark_dependency = false
        console_output_style = classic
    """)
    ctestdir.makepyfile("""
        import pytest

        def test_a():
            pass

        @pytest.mark.dependency(depends=["test_a"])
        def test_b():
            pass
    """)
    result = ctestdir.runpytest("--verbose", "-rs")
    result.assert_outcomes(passed=1, skipped=1, failed=0)
    result.stdout.fnmatch_lines("""
        *::test_a PASSED
        *::test_b SKIPPED
    """)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号