Repository navigation
Closed
pytest-dev/pytest
#2610Description
When running pytest with --doctest-modules and if one of the doctests fails, pytest-sugar fails with a TypeError. For example, here's the invocation of tox on this repro repo:
python create: /Users/jaraco/issue-N/.tox/python
python installdeps: -rtests/requirements.txt
python develop-inst: /Users/jaraco/issue-N
python installed: ----------------------------------------,Error when trying to get requirement for VCS system Command "git config --get-regexp remote\..*\.url" failed with error code 1 in /Users/jaraco/issue-N, falling back to uneditable format,Could not determine repository location of /Users/jaraco/issue-N,appdirs==1.4.3,packaging==16.8,py==1.4.33,pyparsing==2.2.0,pytest==3.0.7,pytest-sugar==0.8.0,six==1.10.0,## !! Could not determine repository location,skeleton==0.1.dev59+g23dae90,termcolor==1.1.0
python runtests: PYTHONHASHSEED='2034398031'
python runtests: commands[0] | py.test
Test session starts (platform: darwin, Python 3.6.1, pytest 3.0.7, pytest-sugar 0.8.0)
rootdir: /Users/jaraco/issue-N, inifile: pytest.ini
plugins: sugar-0.8.0
――――――――――――――――――――――――――――――――――――――――― [doctest] mod ――――――――――――――――――――――――――――――――――――――――――
001
002 Just a failing doctest
003
004 >>> 1
Expected:
0
Got:
1
/Users/jaraco/issue-N/pkg/mod.py:4: DocTestFailure
pkg/mod.py ⨯ 100% ██████████
Results (0.10s):
1 failed
Traceback (most recent call last):
File "/Users/jaraco/issue-N/.tox/python/bin/py.test", line 11, in <module>
sys.exit(main())
File "/Users/jaraco/issue-N/.tox/python/lib/python3.6/site-packages/_pytest/config.py", line 57, in main
return config.hook.pytest_cmdline_main(config=config)
File "/Users/jaraco/issue-N/.tox/python/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "/Users/jaraco/issue-N/.tox/python/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/Users/jaraco/issue-N/.tox/python/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
_MultiCall(methods, kwargs, hook.spec_opts).execute()
File "/Users/jaraco/issue-N/.tox/python/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
res = hook_impl.function(*args)
File "/Users/jaraco/issue-N/.tox/python/lib/python3.6/site-packages/_pytest/main.py", line 127, in pytest_cmdline_main
return wrap_session(config, _main)
File "/Users/jaraco/issue-N/.tox/python/lib/python3.6/site-packages/_pytest/main.py", line 122, in wrap_session
exitstatus=session.exitstatus)
File "/Users/jaraco/issue-N/.tox/python/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "/Users/jaraco/issue-N/.tox/python/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/Users/jaraco/issue-N/.tox/python/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
_MultiCall(methods, kwargs, hook.spec_opts).execute()
File "/Users/jaraco/issue-N/.tox/python/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
return _wrapped_call(hook_impl.function(*args), self.execute)
File "/Users/jaraco/issue-N/.tox/python/lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 250, in _wrapped_call
wrap_controller.send(call_outcome)
File "/Users/jaraco/issue-N/.tox/python/lib/python3.6/site-packages/_pytest/terminal.py", line 374, in pytest_sessionfinish
self.summary_stats()
File "/Users/jaraco/issue-N/.tox/python/lib/python3.6/site-packages/pytest_sugar.py", line 494, in summary_stats
report.location[1] + 1,
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
ERROR: InvocationError: '/Users/jaraco/issue-N/.tox/python/bin/py.test'
____________________________________________ summary _____________________________________________
ERROR: python: commands failed
Metadata
Metadata
Assignees
Labels
No labels
Activity
jaraco commentedon Jul 11, 2017
This issue is a blocker for me. If I can't find a solution for it, I will need to cease use of pytest-sugar in environments where doctests are used.
Are there plans to address this issue? Would you accept a PR with a fix and cut a release of it in short order?
hongquan commentedon Jul 24, 2017
It is because pytest-sugar graps the report from this
which returns
Noneforlineno.Teemu commentedon Oct 17, 2018
#134
Teemu commentedon Oct 17, 2018
I am closing this as #134 is going to be the single ticket related to doctest