Versions

Description

Tasteful testing for Python =========================== testtools is a set of extensions to the Python standard library's unit testing framework. These extensions have been derived from many years of experience with unit testing in Python and come from many different sources. testtools supports Python versions all the way back to Python 2.6. What better way to start than with a contrived code snippet?: .. code-block:: python from testtools import TestCase from testtools.content import Content from testtools.content_type import UTF8_TEXT from testtools.matchers import Equals from myproject import SillySquareServer class TestSillySquareServer(TestCase): def setUp(self): super(TestSillySquare, self).setUp() self.server = self.useFixture(SillySquareServer()) self.addCleanup(self.attach_log_file) def attach_log_file(self): self.addDetail( 'log-file', Content(UTF8_TEXT lambda: open(self.server.logfile, 'r').readlines())) def test_server_is_cool(self): self.assertThat(self.server.temperature, Equals("cool")) def test_square(self): self.assertThat(self.server.silly_square_of(7), Equals(49))

Repository

https://github.com/testing-cabal/testtools.git

Project Slug

testtools

Last Built

5 years, 10 months ago passed

Maintainers

Home Page

https://github.com/testing-cabal/testtools

Badge

Tags

python, testing

Short URLs

testtools.readthedocs.io
testtools.rtfd.io

Default Version

latest

'latest' Version

master