Contribute Media
A thank you to everyone who makes this possible: Read More

Unit testing using monkey patching in pytest

Description

This talk was presented at PyBay2019 - 4th annual Bay Area Regional Python conference. See pybay.com for more details about PyBay and click SHOW MORE for more information about this talk.

Description Unit testing is loved by so many that it is already a very popular concept. But I will try to make unit testing even simpler with pytest using monkey patching. Come to learn about unit testing with pytest using monkey patching.

Abstract Everyone loves unit testing. Developers rarely submit code for reviews without adding unit testing. But can we make this writing unit tests even simpler in Python?

PyTest provides us with an amazing set of tools and libraries to write functional tests, but can PyTest be used for Unit testing also? Of course it can! Not only can you write simple unit tests with PyTest, you can write tests for complex logic as well as code which depend on external services using PyTest. Having worked on PyTest for the last 5 years, I was amazed at the power and capabilities of PyTests for writing quality tests.

Monkey Patching is a common concept, but it is not used widely outside of unit-tests. Python has its own internal libraries for writing unit tests and mocking, MonkeyPatching using PyTest makes the tests a lot simpler to write..

We will cover how PyTest, MonkeyPatching and Unit tests come together to not only make it easy to write tests, but also make it fun.

This talk is for all levels and does not require any specific knowledge of PyTest.

Original slides: https://t.ly/XZWn5

About the speaker Vikram is a software engineer from the Bay Area and has worked at companies like Sony PlayStation and Box. He has been working on Python for the last 5 years mainly in the areas of software automation, tools, infrastructure and software testing. He really enjoys building tools using Python and learning about best practices in coding and software testing.

Sponsor Acknowledgement This and other PyBay2019 videos are via the help of our media partner AlphaVoice (https://www.alphavoice.io/)!

#pybay #pybay2019 #python #python3 #gdb

Details

Improve this page