Display the filename when encountering SyntaxWarning.#4153
Display the filename when encountering SyntaxWarning.#4153asottile merged 1 commit intopytest-dev:masterfrom asottile:syntax_warning_filename
SyntaxWarning.#4153Conversation
```console $ cd t && rm -rf __pycache__ && pytest t.py -q -c /dev/null; cd .. . [100%] =============================== warnings summary =============================== <unknown>:2: DeprecationWarning: invalid escape sequence \. -- Docs: https://docs.pytest.org/en/latest/warnings.html 1 passed, 1 warnings in 0.01 seconds ``` ```console $ cd t && rm -rf __pycache__ && pytest t.py -q -c /dev/null; cd .. . [100%] =============================== warnings summary =============================== /tmp/pytest/t/t.py:2: DeprecationWarning: invalid escape sequence \. '\.wat' -- Docs: https://docs.pytest.org/en/latest/warnings.html 1 passed, 1 warnings in 0.01 seconds ```
What do you mean? A test which at least checks that the filename and |
The only assert(1, 2) # pytest has special handling for this already
def test():
x = 5 # assignment before `global` statement, a `SyntaxError` in py3+
global x
'\.' # SyntaxError in python3.8+, not a warning in python<3.6any way I'd write this would become obsolete at some point |
|
I see. Well, better than nothing I guess. 😁 Can you take a look at the Travis failure please? |
|
hmm, passes locally: going to click retry -- I suspect some sort of race with xdist / coverage :S |
|
Here's the error message in case we hit it again: |
|
passed 🤷♂️ |
|
Weird, OK let's keep an eye on it. 👍 |
|
Ouch it happened again: https://travis-ci.org/pytest-dev/pytest/jobs/441861559 😢 |
|
Created an issue: #4162 |
Resolves #4152
Couldn't think of a way to test this without implementation / version specific code 🤷♂️ -- at least the commit message contains the reproduction
before
after