Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Funcargs and other fun with pytest
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Brianna Laugher
August 18, 2012
Technology
280
0
Share
Funcargs and other fun with pytest
Presented at PyCon AU 2012.
Brianna Laugher
August 18, 2012
More Decks by Brianna Laugher
See All by Brianna Laugher
Realities of open source testing: Lessons learned from Adopt Pytest Month
pfctdayelise
0
240
Crowd funded free software
pfctdayelise
0
190
Dynamic visualisation in the IPython Notebook
pfctdayelise
0
270
Zookeepr: home grown conference management software
pfctdayelise
0
190
Why "gender" should be a text field
pfctdayelise
0
260
Distributed wikis
pfctdayelise
0
200
Neurosexism
pfctdayelise
0
310
Clash of the encyclopedias: is competition good for sharing?
pfctdayelise
0
200
Language sleuthing HOWTO
pfctdayelise
0
230
Other Decks in Technology
See All in Technology
AIペネトレーションテスト・ セキュリティ検証「AgenticSec」ご紹介資料
laysakura
0
1.6k
Oracle AI Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
6
1.3k
Hello UUID
mimifuwacc
0
120
さくらのクラウドでつくるCloudNative Daysのオブザーバビリティ基盤
b1gb4by
0
120
Cortex Code君、今日から内製化支援担当ね。
coco_se
0
300
40代からのアウトプット ― 経験は価値ある学びに変わる / 20260404 Naoki Takahashi
shift_evolve
PRO
5
900
ASTのGitHub CopilotとCopilot CLIの現在地をお話しします/How AST Operates GitHub Copilot and Copilot CLI
aeonpeople
1
200
Databricks Appsで実現する社内向けAIアプリ開発の効率化
r_miura
0
340
AIドリブン開発の実践知 ― AI-DLC Unicorn Gym実施から見えた可能性と課題
mixi_engineers
PRO
0
120
制約を設計する - 非決定性との境界線 / Designing constraints
soudai
PRO
6
2.3k
OpenClaw初心者向けセミナー / OpenClaw Beginner Seminar
cmhiranofumio
0
360
Babylon.js Japan Activities (2026/4)
limes2018
0
190
Featured
See All Featured
Faster Mobile Websites
deanohume
310
31k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.3k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
870
KATA
mclloyd
PRO
35
15k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
Claude Code のすすめ
schroneko
67
220k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
310
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
170
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
410
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.6k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Transcript
PyCon AU 2012 Brianna Laugher funcargs & other fun with
pytest
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!
None
my background • using pytest seriously for ~18 months at
work • really enjoying it! • how it feels to use pytest: →
None
None
None
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)
None
informative error reporting
informative error reporting
extensible • e.g. add in unittest assert methods
extensible • e.g. add hook for winpdb
None
skip
xfail
custom markers
None
parametrize
None
generate tests • defined once per module • list/generate data
to supply to 1+ tests • way more flexible cf. py.test.mark.parametrize
generate generators!
None
monkeypatch
None
None
None
None
funcargs!
funcargs – idealised db example
funcargs – trivial django example
funcargs – trivial GAE examples
funcargs – trivial GAE examples
None
funcargs – why? • dependency injection, aka inversion of control
• works a treat with TDD • very natural with mocking • encourages modular design
None
funcargs – a real DB example
funcargs – a real DB example
funcargs – to express prereq's • for when a decorator
is not powerful enough
None
funcargs – to hide monkeypatch :)
None
generate + funcarg - anypython
None
None
pytest – the future
None
test evolution -v0
None
test evolution - v1
test evolution - v2
test evolution – v3
test evolution - v4
None
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!
None
None
• http://codespeak.net/mailman/listinfo/py-dev • testing-in-python mailing list • Stack Overflow •
lead developer Holger Krekel is very responsive
pytest.org
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
[email protected]
brianna.laugher.id.au /
[email protected]
@pfctdayelise