gnikonorov:~/pytest [issue_4049] $ git diff diff --git a/src/_pytest/warnings.py b/src/_pytest/warnings.py index 3ae3c8639..a32c8f017 100644 --- a/src/_pytest/warnings.py +++ b/src/_pytest/warnings.py @@ -112,10 +112,10 @@ def catch_warnings_for_item(config, ihook, when, item): for warning_message in log: ihook.pytest_warning_captured.call_historic( - kwargs=dict(warning_message=warning_message, when=when, item=item) + kwargs=dict(warning_message=warning_message, when=when, item=item, location=None) ) ihook.pytest_warning_recorded.call_historic( - kwargs=dict(warning_message=warning_message, nodeid=nodeid, when=when) + kwargs=dict(warning_message=warning_message, nodeid=nodeid, when=when, location=None) ) gnikonorov:~/pytest [issue_4049] $ (pytest-html) gnikonorov:~/pytest-html$ pip install -e ../pytest Obtaining file:///home/gnikonorov/pytest Installing build dependencies ... done Getting requirements to build wheel ... done Preparing wheel metadata ... done Requirement already satisfied: packaging in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from pytest==5.4.1.dev358+g125b663f2.d20200526) (20.4) Requirement already satisfied: more-itertools>=4.0.0 in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from pytest==5.4.1.dev358+g125b663f2.d20200526) (8.3.0) Requirement already satisfied: importlib-metadata>=0.12; python_version < "3.8" in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from pytest==5.4.1.dev358+g125b663f2.d20200526) (1.6.0) Requirement already satisfied: attrs>=17.4.0 in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from pytest==5.4.1.dev358+g125b663f2.d20200526) (19.3.0) Requirement already satisfied: pluggy<1.0,>=0.12 in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from pytest==5.4.1.dev358+g125b663f2.d20200526) (0.13.1) Requirement already satisfied: py>=1.5.0 in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from pytest==5.4.1.dev358+g125b663f2.d20200526) (1.8.1) Requirement already satisfied: wcwidth in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from pytest==5.4.1.dev358+g125b663f2.d20200526) (0.1.9) Requirement already satisfied: pyparsing>=2.0.2 in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from packaging->pytest==5.4.1.dev358+g125b663f2.d20200526) (3.0.0a1) Requirement already satisfied: six in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from packaging->pytest==5.4.1.dev358+g125b663f2.d20200526) (1.15.0) Requirement already satisfied: zipp>=0.5 in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from importlib-metadata>=0.12; python_version < "3.8"->pytest==5.4.1.dev358+g125b663f2.d20200526) (3 .1.0) Installing collected packages: pytest Attempting uninstall: pytest Found existing installation: pytest 5.4.1.dev358+g125b663f2 Uninstalling pytest-5.4.1.dev358+g125b663f2: Successfully uninstalled pytest-5.4.1.dev358+g125b663f2 Running setup.py develop for pytest Successfully installed pytest (pytest-html) gnikonorov:~/pytest-html$ pip install -e . && pytest --html=report_gleb.html test_gleb_local_changes.py Obtaining file:///home/gnikonorov/pytest-html Requirement already satisfied: pytest>=5.0 in /home/gnikonorov/pytest/src (from pytest-html==2.1.2.dev9+g4acbc33.d20200526) (5.4.1.dev358+g125b663f2.d20200526) Requirement already satisfied: pytest-metadata in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from pytest-html==2.1.2.dev9+g4acbc33.d20200526) (1.9.0) Requirement already satisfied: py>=1.5.0 in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from pytest>=5.0->pytest-html==2.1.2.dev9+g4acbc33.d20200526) (1.8.1) Requirement already satisfied: packaging in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from pytest>=5.0->pytest-html==2.1.2.dev9+g4acbc33.d20200526) (20.4) Requirement already satisfied: attrs>=17.4.0 in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from pytest>=5.0->pytest-html==2.1.2.dev9+g4acbc33.d20200526) (19.3.0) Requirement already satisfied: more-itertools>=4.0.0 in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from pytest>=5.0->pytest-html==2.1.2.dev9+g4acbc33.d20200526) (8.3.0) Requirement already satisfied: pluggy<1.0,>=0.12 in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from pytest>=5.0->pytest-html==2.1.2.dev9+g4acbc33.d20200526) (0.13.1) Requirement already satisfied: wcwidth in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from pytest>=5.0->pytest-html==2.1.2.dev9+g4acbc33.d20200526) (0.1.9) Requirement already satisfied: importlib-metadata>=0.12 in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from pytest>=5.0->pytest-html==2.1.2.dev9+g4acbc33.d20200526) (1.6.0) Requirement already satisfied: six in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from packaging->pytest>=5.0->pytest-html==2.1.2.dev9+g4acbc33.d20200526) (1.15.0) Requirement already satisfied: pyparsing>=2.0.2 in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from packaging->pytest>=5.0->pytest-html==2.1.2.dev9+g4acbc33.d20200526) (3.0.0a1) Requirement already satisfied: zipp>=0.5 in /home/gnikonorov/.local/share/virtualenvs/pytest-html-k1-ITgOR/lib/python3.6/site-packages (from importlib-metadata>=0.12->pytest>=5.0->pytest-html==2.1.2.dev9+g4acbc33.d20200526) (3.1.0) Installing collected packages: pytest-html Attempting uninstall: pytest-html Found existing installation: pytest-html 2.1.2.dev9+g4acbc33.d20200526 Uninstalling pytest-html-2.1.2.dev9+g4acbc33.d20200526: Successfully uninstalled pytest-html-2.1.2.dev9+g4acbc33.d20200526 Running setup.py develop for pytest-html Successfully installed pytest-html /home/gnikonorov/pytest-html/pytest_html/plugin.py:630: DeprecationWarning: pytest_warning_captured is deprecated and will be removed soon def pytest_warning_captured(self, warning_message, when, item, location): =========================================================================================================== test session starts ============================================================================================================ platform linux -- Python 3.6.9, pytest-5.4.1.dev358+g125b663f2.d20200526, py-1.8.1, pluggy-0.13.1 rootdir: /home/gnikonorov/pytest-html, inifile: tox.ini plugins: metadata-1.9.0, html-2.1.2.dev9+g4acbc33.d20200526 collected 1 item test_gleb_local_changes.py . [100%]pytest_warning_capture called ============================================================================================================= warnings summary ============================================================================================================= test_gleb_local_changes.py::test_one /home/gnikonorov/pytest-html/test_gleb_local_changes.py:5: UserWarning: api v1, should use functions from v2 warnings.warn(UserWarning("api v1, should use functions from v2")) -- Docs: https://docs.pytest.org/en/latest/warnings.html -------------------------------------------------------------------------------- generated html file: file:///home/gnikonorov/pytest-html/report_gleb.html --------------------------------------------------------------------------------- ======================================================================================================= 1 passed, 1 warning in 0.02s ======================================================================================================= (pytest-html) gnikonorov:~/pytest-html$ ^C