Video - http://www.youtube.com/watch?v=DTNejE9EraI
Code - https://gist.github.com/3386951
Pytest is a mature and comprehensive testing suite for Python projects, but it can be a little intimidating for newcomers. Where do these mysterious funcargs come from, how do parametrised tests work, and where are my xUnit-style setUp and tearDown methods?
Pytest lives by "convention over configuration" - which is great once you know what the conventions are. This talk will look at real examples of pytest in use, emphasising the features that differentiate it from nose.
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Funcargs & other fun with pytest
1. funcargs &
other fun
with
pytest
PyCon AU 2012
Brianna Laugher
2. pytest – all the good stuff
✔
all test styles: unittest, doctest, nose
✔
boilerplate-free style – natural asserts
✔
support for running tests distributed, boxed
✔
generate JUnit-style XML for Jenkins CI
✔
informative error reporting
✔
extensible plugins, useful builtins
✔
skip, xfail, custom markers
✔
parametrize, generate tests
✔
monkeypatch
✔
funcargs!
3.
4. my background
●
using pytest seriously for ~18 months at work
●
really enjoying it!
●
how it feels to use pytest: →
5.
6.
7.
8. Graphical Forecast Editor
●
client/server desktop application used by
forecasters to generate the (text & graphical)
forecasts
●
pilot in VIC, funding to roll out nationally, ~5
year project, 20+ new devs/testers
●
existing codebase of Python and C++ (used
operationally in US)
●
home-grown test suite and runner (via GUI)
60. credits, thanks, contact
Comic panels from comicallyvintage.tumblr.com
Bureau of Meteorology
●
In particular, Darius Powell introduced pytest to our
project
Code examples: gist.github.com/3386951
brianna@modernthings.org
brianna.laugher.id.au / b.laugher@bom.gov.au
@pfctdayelise