Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
testtools - adding test details (content objects) to your tests
#!/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
You can’t perform that action at this time.