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: oolsPythonpydatahuogecasevenvScriptspython.exe E: oolsPythonJetBrainsPyCharm2020pluginspythonhelperspycharm\_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: oolsPythonpydatahuogecase est_requests

============================= test session starts =============================
platform win32 -- Python 3.5.0, pytest-6.0.1, py-1.9.0, pluggy-0.13.1 -- E: oolsPythonpydatahuogecasevenvScriptspython.exe
cachedir: .pytest_cache
rootdir: E: oolsPythonpydatahuogecase est_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打印不出来,暂时没看出来问题,以后再解决吧

原文地址:https://www.cnblogs.com/hqsbrx/p/13620952.html