Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
Unittest AsyncMock
Pranay Suresh
February 05, 2020
Technology
0
51
Unittest AsyncMock
Talk about how to mock async methods in different versions of Python
Pranay Suresh
February 05, 2020
Tweet
Share
More Decks by Pranay Suresh
See All by Pranay Suresh
bottlejammy
0
4
bottlejammy
0
9
Other Decks in Technology
See All in Technology
kanaugust
PRO
0
110
kaga
0
240
lmi
5
3.5k
ocise
0
120
ishiayaya
PRO
0
140
picardparis
4
2.4k
honai
9
5.7k
tutsunom
1
330
hgsgtk
1
860
surumegohan
1
170
kentaro
2
450
tatsy
0
120
Featured
See All Featured
chrislema
173
14k
jponch
103
5.1k
eileencodes
114
25k
smashingmag
283
47k
brettharned
93
3.1k
hatefulcrawdad
257
17k
rasmusluckow
318
19k
robhawkes
52
2.9k
philnash
10
660
davidbonilla
70
3.6k
hannesfritz
28
970
samlambert
237
10k
Transcript
Unittest AsyncMock https://pranaysuresh.com/ https://www.linkedin.com/in/pranaysuresh/
None
None
Because...
Prior to Python 3.8 Option 1: Custom solution
Prior to Python 3.8
Prior to Python 3.8 Option 2: asynctest library: https://pypi.org/project/asynctest/
Python 3.8
None
Other features: assert_awaited, assert_awaited_once, assert_awaited_with, await_count etc etc.
Other features: Mock iterators
Other features: Mock context managers
Thank You!