Created
July 7, 2014 16:25
-
-
Save cgoldberg/7b9a90a4a889335dc025 to your computer and use it in GitHub Desktop.
testtools - adding test details (content objects) to your tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# | |
# This example adds testtools Details from a testtools TestCase. | |
# | |
# For more information about: testtools, Details, and Content Objects, visit: | |
# * https://testtools.readthedocs.org/en/latest/for-test-authors.html#details | |
from testtools import TestCase | |
from testtools.content import ( | |
ContentType, | |
content_from_file, | |
text_content, | |
) | |
class TestSomething(TestCase): | |
def test_add_text_detail(self): | |
self.addDetail('arbitrary-text', text_content('I am a text detail')) | |
def test_add_image_detail(self): | |
image = content_from_file('image.jpg', ContentType('image', 'jpg')) | |
self.addDetail('image.jpg', image) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment