Skip to content

Instantly share code, notes, and snippets.

@durden
Created April 3, 2014 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save durden/9955666 to your computer and use it in GitHub Desktop.
Save durden/9955666 to your computer and use it in GitHub Desktop.
Demonstrate py.test failure
def func_1():
return ['a', 'b', 'c']
def func_2():
"""
>>> func_1()
['a', 'b', 'c']
"""
pass
py.test /tmp/test.py --doctest-modules
=========================================================================================== test session starts ===========================================================================================
platform darwin -- Python 2.7.6 -- py-1.4.20 -- pytest-2.5.2
collected 1 items
../../../../tmp/test.py ['a', 'b', 'c']
F
================================================================================================ FAILURES =================================================================================================
__________________________________________________________________________________________ [doctest] test.func_2 __________________________________________________________________________________________
005 """
006 >>> func_1()
Expected:
['a', 'b', 'c']
Got nothing
/tmp/test.py:6: DocTestFailure
======================================================================================== 1 failed in 0.02 seconds =========================================================================================
py.test -s /tmp/test.py --doctest-modules
=========================================================================================== test session starts ===========================================================================================
platform darwin -- Python 2.7.6 -- py-1.4.20 -- pytest-2.5.2
collected 1 items
../../../../tmp/test.py .
======================================================================================== 1 passed in 0.01 seconds =========================================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment