A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2008-July/081320.html below:

[Python-Dev] light-weight testing

[Python-Dev] light-weight testing [Python-Dev] light-weight testingNick Coghlan ncoghlan at gmail.com
Thu Jul 17 12:34:34 CEST 2008
Antoine Pitrou wrote:
> (especially when you come to have setup/teardown functions shared by several 
> tests).

These days, I tend to just write a context manager for common 
setup/teardown code rather than using the setUp/tearDown hooks (at least 
for Python's own test suite, where I have the luxury of assuming 2.5+ as 
the Python version).

Where I find unittest.TestCase quite convenient is when I want to run 
the same set of tests with a few different settings - for those, putting 
the settings into class attributes and then inheriting from the basic 
test case and using different values is very convenient. This trick is 
particularly useful for testing that a class supports inheritance properly.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4