python logging打印不出来


import requests
import logging
import pytest


class TestRequest(object):
    logging.basicConfig(level=logging.INFO)

    def test_getRequest(self):
        print("111111111")
        logging.info("Start print log")
        params_get = {"limit": 2}
        r = requests.get(url="https://testerhome.com/api/v3/topics.json", params=params_get)
        logging.info(r)
        logging.info(r.json())


# if __name__ == '__mian__':
#     print("5678992345678")
#     TestRequest.test_getRequest()

 

运行结果

Testing started at 10:39 ...
E:\tools\Python\pydata\huogecase\venv\Scripts\python.exe E:\tools\Python\JetBrains\PyCharm2020\plugins\python\helpers\pycharm\_jb_pytest_runner.py --path E:/tools/Python/pydata/huogecase/test_requests/test_get_requests.py
Launching pytest with arguments E:/tools/Python/pydata/huogecase/test_requests/test_get_requests.py in E:\tools\Python\pydata\huogecase\test_requests

============================= test session starts =============================
platform win32 -- Python 3.5.0, pytest-6.0.1, py-1.9.0, pluggy-0.13.1 -- E:\tools\Python\pydata\huogecase\venv\Scripts\python.exe
cachedir: .pytest_cache
rootdir: E:\tools\Python\pydata\huogecase\test_requests
collecting ... collected 1 item

test_get_requests.py::TestRequest::test_getRequest

============================== 1 passed in 0.87s ==============================

Process finished with exit code 0
PASSED [100%]111111111

 

 

 

打印出来111111111表示  test_getRequest 方法已经执行了,但是logging打印不出来,暂时没看出来问题,以后再解决吧

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM