輸入pytest 輸入魅力の 輸入SYS、OSの インポートログ インポート日時 デフlogInit(): now_time = datetime.datetime.now() filePathに = os.getcwd()+ " \\ログ\\ " 場合 os.path.exists(filePathに)である:偽 os.makedirs(filePathに) ログファイル = filePathに+ now_time.strftime(" %Y%M%D_%H%M%S ")+ " の.log " logging.basicConfig(ファイル名 = ログファイル、 ファイルモード = " W " 、 形式 = " %(いるasctime)S - [行:%(LINENO)D] - %(levelname)S - %(ファイル名)S - %(メッセージ)S " 、 レベル = logging.DEBUG) logInit() @ allure.feature(' 手動オーバライドのテストケース' ) クラスTestStringMethods(): @classmethod デフsetup_class(CLS): logging.info(" セットアップクラス" ) @classmethod デフteardown_class(CLS): logging.info(" ティアダウンクラス") allure.feature(@ ' test_demo1 ' ) allure.severity(@ ' 遮断' ) DEF test_demo_0_1(自己): = 10 、B = 11 アサート Aがで ないB (logging.info " ========= ======== test_demo_0_1 =============== 」) allure.feature(@ ' test_demo1 ' ) allure.severity(@ ' ブロッカー' ) デフtest_demo_0_2(自己): A = 11 、B = 11 アサート A れるBの logging.errorは、(" =%dをアサートB =%dです"%(B)) であれば __name__ == ' __main__ ' : pytest.main ()