[melbourne-pug] Unit Testing Tools

Stephen Moore delfick755 at gmail.com
Thu Aug 22 15:57:48 CEST 2013


That testtools thing looks pretty interesting, I haven't seen that before...

As for more suggestions,

I tend to make my tests with classes based inheriting from unittest.TestCase
Using nose for test discovery and plugins like my noseOfYeti plugin
https://noseofyeti.readthedocs.org/en/latest/
And fudge for mocking http://farmdev.com/projects/fudge/

Also, I haven't used it, but tox looks pretty cool
http://codespeak.net/tox/index.html

Stephen.

On Thu, Aug 22, 2013 at 2:15 PM, Ben Finney <ben+python at benfinney.id.au> wrote:
> Rasjid Wilcox <rasjid at familywilcox.net> writes:
>
>> To date I've mostly used Nose for my unit testing, but was just
>> wanting to canvas views on what the current state of the art in Python
>> testing is, and if I should be looking at something else.
>
> I use Python 2.7, or Python 3, and use the standard library ‘unittest’
> along with ‘testtools’ <URL:http://testtools.readthedocs.org/>
> and ‘testscenarios’ <URL:https://pypi.python.org/pypi/testscenarios>.
>
> The ‘unittest’ library in Python's standard library has been
> significantly improved. Developers using Python 3 get the full benefits,
> but Python 2.7 also had many of the improvements back-ported.
>
> * Test case discovery
> * Specify test cases from command line
> * More assertion methods, more comparison methods
> * ‘assertRaises’ as a context manager (for ‘with’)
> * Adding cleanup functions
> * Skipping tests conditionally
> * Class-level and module-level fixtures
> * etc.
>
> Michael Foord was a primary developer and advocate of these
> improvements. Here is his description from 2011
> <URL:http://www.voidspace.org.uk/python/articles/unittest2.shtml>.
>
> All those improvements, along with the wonderful author-defined Matchers
> in ‘testtools’ and the data-driven testing from ‘testscenarios’, I
> virtually have no need of anything more than those.
>
> And they're easily accepted by my team, whereas switching to a different
> test framework would be (correctly) met with much more resistance.
>
> --
>  \         “Sunday: A day given over by Americans to wishing that they |
>   `\      themselves were dead and in Heaven, and that their neighbors |
> _o__)                        were dead and in Hell.” —Henry L. Mencken |
> Ben Finney
>
> _______________________________________________
> melbourne-pug mailing list
> melbourne-pug at python.org
> http://mail.python.org/mailman/listinfo/melbourne-pug


More information about the melbourne-pug mailing list