>> g = 5 >>> g 5 \"\"\" Would run and look like this:" />
开发者

Django Tests Printing instead of Returning Results

开发者 https://www.devze.com 2022-12-13 09:23 出处:网络
I\'m suddenly running into an issue where docstring tests like this: \"\"\" >>> g = 5 >>> g 5 \"\"\" Would run and look like this:

I'm suddenly running into an issue where docstring tests like this:


"""

>>> g = 5

>>> g

5

"""

Would run and look like this:

...
Installing Index for ModeName

....

5...

Failed example:

 g

Expected:

5

Got nothing

In short开发者_开发知识库, it's printing out the expected results instead of returning them! What would cause something like this? I've been digging for hours.


Aren't you supposed to show the expected result when running tests through Django, like the following:

"""
>>> g = 5

>>> g == 5
True
"""


It eventually started working again though I'm not 100% sure why. I think there was an IO issue with setting the stdio

import sys sys.stdout = sys.stdout sys.stderr = sys.stderr

0

精彩评论

暂无评论...
验证码 换一张
取 消