summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Hồng Quân <ng.hong.quan@gmail.com>2017-07-24 23:07:45 +0700
committerNguyễn Hồng Quân <ng.hong.quan@gmail.com>2017-07-24 23:07:45 +0700
commitd40d77432c71d8eaa6bbc1dfb908fbcd4fe2bbb1 (patch)
tree176e9ec8e308ca9e9b5d5bc788284ce800c0b44f
parentdea671f8ba3a76283735e8414a11595bc755872d (diff)
downloadpytest-d40d77432c71d8eaa6bbc1dfb908fbcd4fe2bbb1.tar.gz
Add test case for DoctestItem.reportinfo()
-rw-r--r--testing/test_doctest.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/testing/test_doctest.py b/testing/test_doctest.py
index dd444569c..8a81ea0ed 100644
--- a/testing/test_doctest.py
+++ b/testing/test_doctest.py
@@ -545,6 +545,22 @@ class TestDoctests(object):
result = testdir.runpytest(p, '--doctest-modules')
result.stdout.fnmatch_lines(['* 1 passed *'])
+ def test_reportinfo(self, testdir):
+ '''
+ Test case to make sure that DoctestItem.reportinfo() returns lineno.
+ '''
+ p = testdir.makepyfile(test_reportinfo="""
+ def foo(x):
+ '''
+ >>> foo('a')
+ 'b'
+ '''
+ return 'c'
+ """)
+ items, reprec = testdir.inline_genitems(p, '--doctest-modules')
+ reportinfo = items[0].reportinfo()
+ assert reportinfo[1] == 1
+
class TestLiterals(object):