-
- Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
plugin: doctestsrelated to the doctests builtin pluginrelated to the doctests builtin plugintopic: reportingrelated to terminal output and user-facing messages and errorsrelated to terminal output and user-facing messages and errorstype: bugproblem that needs to be addressedproblem that needs to be addressed
Description
When there are doctest tests on a @property
method, pytest does not show the line number where the error occurred. For example on code
class Fun(object): @property def test_prop(self): ''' >>> Fun().test_prop 'another thing' ''' return 'something'
running pytest produces the following output
python3 -m pytest --doctest-modules ============================= test session starts ============================== platform linux -- Python 3.7.5rc1, pytest-5.2.2, py-1.8.0, pluggy-0.12.0 hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/<some-path>/.hypothesis/examples') rootdir: /<some-path> plugins: hypothesis-4.41.3 collected 1 item hello.py F [100%] =================================== FAILURES =================================== ________________________ [doctest] hello.Fun.test_prop _________________________ EXAMPLE LOCATION UNKNOWN, not showing all tests of that example ??? >>> Fun().test_prop Expected: 'another thing' Got: 'something' /<some-path>/hello.py:None: DocTestFailure ============================== 1 failed in 0.01s ===============================
Notice ???
instead of the line number. Expected output would be
005 006 >>> Fun().test_prop Expected: 'another thing' Got: 'something'
I've tried it with Python 3.7.5rc1, Python 3.8.0, and Python 2.7.17rc1. The results are the same.
connorbrinton
Metadata
Metadata
Assignees
Labels
plugin: doctestsrelated to the doctests builtin pluginrelated to the doctests builtin plugintopic: reportingrelated to terminal output and user-facing messages and errorsrelated to terminal output and user-facing messages and errorstype: bugproblem that needs to be addressedproblem that needs to be addressed