New issue 606: INTERNALERROR when no valid source lines found
https://bitbucket.org/hpk42/pytest/issue/606/internalerror-when-no-valid-source-lines

Jędrzej Nowak:

```
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/_pytest/main.py", 
line 84, in wrap_session
INTERNALERROR>     doit(config, session)
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/_pytest/main.py", 
line 122, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/_pytest/core.py", 
line 413, in __call__
INTERNALERROR>     return self._docall(methods, kwargs)
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/_pytest/core.py", 
line 424, in _docall
INTERNALERROR>     res = mc.execute()
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/_pytest/core.py", 
line 315, in execute
INTERNALERROR>     res = method(**kwargs)
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/_pytest/main.py", 
line 142, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, 
nextitem=nextitem)
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/_pytest/core.py", 
line 413, in __call__
INTERNALERROR>     return self._docall(methods, kwargs)
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/_pytest/core.py", 
line 424, in _docall
INTERNALERROR>     res = mc.execute()
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/_pytest/core.py", 
line 315, in execute
INTERNALERROR>     res = method(**kwargs)
INTERNALERROR>   File 
"/tmp/venv/lib/python2.7/site-packages/_pytest/runner.py", line 65, in 
pytest_runtest_protocol
INTERNALERROR>     runtestprotocol(item, nextitem=nextitem)
INTERNALERROR>   File 
"/tmp/venv/lib/python2.7/site-packages/_pytest/runner.py", line 75, in 
runtestprotocol
INTERNALERROR>     reports.append(call_and_report(item, "call", log))
INTERNALERROR>   File 
"/tmp/venv/lib/python2.7/site-packages/_pytest/runner.py", line 111, in 
call_and_report
INTERNALERROR>     report = hook.pytest_runtest_makereport(item=item, call=call)
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/_pytest/main.py", 
line 167, in call_matching_hooks
INTERNALERROR>     return hookmethod.pcall(plugins, **kwargs)
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/_pytest/core.py", 
line 417, in pcall
INTERNALERROR>     return self._docall(methods, kwargs)
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/_pytest/core.py", 
line 424, in _docall
INTERNALERROR>     res = mc.execute()
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/_pytest/core.py", 
line 315, in execute
INTERNALERROR>     res = method(**kwargs)
INTERNALERROR>   File 
"/tmp/venv/lib/python2.7/site-packages/_pytest/runner.py", line 214, in 
pytest_runtest_makereport
INTERNALERROR>     longrepr = item.repr_failure(excinfo)
INTERNALERROR>   File 
"/tmp/venv/lib/python2.7/site-packages/_pytest/python.py", line 600, in 
repr_failure
INTERNALERROR>     return self._repr_failure_py(excinfo, style=style)
INTERNALERROR>   File 
"/tmp/venv/lib/python2.7/site-packages/_pytest/python.py", line 593, in 
_repr_failure_py
INTERNALERROR>     style=style)
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/_pytest/main.py", 
line 412, in _repr_failure_py
INTERNALERROR>     style=style, tbfilter=tbfilter)
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/py/_code/code.py", 
line 412, in getrepr
INTERNALERROR>     return fmt.repr_excinfo(self)
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/py/_code/code.py", 
line 590, in repr_excinfo
INTERNALERROR>     reprtraceback = self.repr_traceback(excinfo)
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/py/_code/code.py", 
line 582, in repr_traceback
INTERNALERROR>     reprentry = self.repr_traceback_entry(entry, einfo)
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/py/_code/code.py", 
line 543, in repr_traceback_entry
INTERNALERROR>     s = self.get_source(source, line_index, excinfo, short=short)
INTERNALERROR>   File "/tmp/venv/lib/python2.7/site-packages/py/_code/code.py", 
line 484, in get_source
INTERNALERROR>     lines.append(self.flow_marker + "   " + 
source.lines[line_index])
INTERNALERROR> IndexError: list index out of range
```

The reason for this is error in macropy generated code. When it crashes inside 
macro then it propagates wrong line numbers 
(https://github.com/lihaoyi/macropy#line-numbers).

But the same "wrong line numbers" applies to:
- saved/changed file after test started
- probably other code modifications

I would expect one of two things there:
- same behavior that is in `--tb native` OR
- some kind of message "no source code could be detected".

The bad thing about this `INTERNALERROR` is that it makes pytest to fail.


_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to