-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
plugin: warningsrelated to the warnings builtin pluginrelated to the warnings builtin plugin
Description
import pytest
def test():
'\d' # should be a warning
@pytest.mark.xfail
def test_expected_failure():
assert False
$ pytest t.py
============================= test session starts ==============================
platform linux -- Python 3.6.6, pytest-3.9.3, py-1.7.0, pluggy-0.8.0
rootdir: /tmp/t, inifile:
collected 2 items
t.py .x [100%]
=============================== warnings summary ===============================
t.py:5
/tmp/t/t.py:5: DeprecationWarning: invalid escape sequence \d
'\d' # should be a warning
t.py::test_expected_failure
source:5: DeprecationWarning: invalid escape sequence \d
-- Docs: https://docs.pytest.org/en/latest/warnings.html
=============== 1 passed, 1 xfailed, 2 warnings in 0.04 seconds ================
I was at first confused by the "source" bit, that appears to come from here:
pytest/src/_pytest/_code/source.py
Line 293 in e6e40db
astnode = compile(content, "source", "exec", 1024) # 1024 for AST |
would have to change the signature probably to pass along the filename so that doesn't say "source" in the output. Might have to do some other clever things to make sure it doesn't get invoked at all when unnecessary 🤷♂️
Metadata
Metadata
Assignees
Labels
plugin: warningsrelated to the warnings builtin pluginrelated to the warnings builtin plugin