柚子快報激活碼778899分享:pytest解決
柚子快報激活碼778899分享:pytest解決
pytest運(yùn)行報錯 D:\PyCharm\PyCharm Community Edition 2020.1.1\plugins\python-ce\helpers\pycharm\_jb_pytest_runner.py:7: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html from pkg_resources import iter_entry_points 打開所在路徑: D:\PyCharm\PyCharm Community Edition 2020.1.1\plugins\python-ce\helpers\pycharm_jb_pytest_runner.py:7
移除或注釋掉pkg_resources的導(dǎo)入語句:
# from pkg_resources import iter_entry_points
修改使用iter_entry_points的代碼,改用importlib.metadata.entry_points。
原來的代碼:
if "pytest-teamcity" not in map(lambda e: e.name, iter_entry_points(group='pytest11', name=None)):
修改后的代碼:
from importlib.metadata import entry_points
if "pytest-teamcity" not in [e.name for e in entry_points().get('pytest11', [])]:
這樣就可以避免使用已棄用的pkg_resources API,同時解決DeprecationWarning問題。
柚子快報激活碼778899分享:pytest解決
文章鏈接
本文內(nèi)容根據(jù)網(wǎng)絡(luò)資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點和立場。
轉(zhuǎn)載請注明,如有侵權(quán),聯(lián)系刪除。