zoukankan      html  css  js  c++  java
  • 固件:

    import pytest
    import requests
    @pytest.fixture()
    def login():
    print("登录.......")

    def test_index1(login):
    """测试之前先登录"""
    print("主页1..........")

    def test_index2(login):
    """测试之前先登录"""
    print("主页2..........")

    if __name__ == '__main__':
    pytest.main(["-s","test_case.py"])

    结果:

    =========================================================== test session starts ============================================================
    platform win32 -- Python 3.6.6, pytest-5.3.2, py-1.8.1, pluggy-0.13.1 -- c:python36python.exe
    cachedir: .pytest_cache
    rootdir: D:s27day68, inifile: pytest.ini, testpaths: ./scripts
    collected 2 items

    scripts/test_case.py::test_index1 登录.......
    主页1..........
    PASSED
    scripts/test_case.py::test_index2 登录.......
    主页2..........
    PASSED

    ============================================================= warnings summary =============================================================
    scripts est_case.py:93
    D:s27day68scripts est_case.py:93: DeprecationWarning: invalid escape sequence s
    """

    -- Docs: https://docs.pytest.org/en/latest/warnings.html
    ======================================================= 2 passed, 1 warning in 0.51s =======================================================

  • 相关阅读:
    阿狸的打字机(bzoj 2434)
    Censoring(bzoj 3940)
    文本生成器(bzoj 1030)
    病毒(bzoj 2938)
    Road(bzoj 2750)
    codevs 2370 小机房的树
    HDU 2838 Cow Sorting
    luogu P2253 好一个一中腰鼓!
    hdu 1166 敌兵布阵
    luogu P1901 发射站
  • 原文地址:https://www.cnblogs.com/zhang-da/p/12220903.html
Copyright © 2011-2022 走看看