Загрузка страницы

Build your own Python unit test framework in 100 lines of code - part 2

In this video step by step we'll build our own Python unit testing framework. In the first part we wrote a test runner, and now we'll work on our own assertion librar

Hi folks! Welcome to Not Only Code! Today we're doing an intermediate/advanced Python tutorial where you'll build your own Python unit testing framework that will be a simple version of libraries like unittest or pytest.

⌨️ Source code: https://github.com/arnvald/noctest
📚 Resources
All the libraries I use in this tutorial are part of Python standard library, I don't use any external sources

* https://docs.python.org/3/library/inspect.html - inspect library I use to get all methods from a module to find tests there
* https://docs.python.org/3/library/importlib.html - importlib is a library that gives API to load modules using file path instead of a module name

* https://docs.python.org/3/library/types.html - types library I use to create a new module
* https://docs.python.org/3/library/operator.html - operator module offerst functions that act like operators, for example == or !=
🎥 Timeline:
0:00 recap of part 1
0:47 what is assertion library
1:52 turn module into a package
2:44 make package executable
4:24 assertion library scaffold
7:37 custom toEqual function
8:45 support the new library
11:32 add notToEqual
13:00 refactoring expectation module
17:52 support for toInclude function
19:50 writing custom operator function
21:43 update test reporting
25:06 in the next episode...

If you enjoy this kind of content, check out my website, 🌏 https://notonlycode.org, where I publish more in-depth articles about software development.

As always, if you have any questions, suggestions or feedback, you can contact me:
✉️ email: gregory@notonlycode.org
🐦 Twitter: @GregoryWitek

Видео Build your own Python unit test framework in 100 lines of code - part 2 канала Not Only Code
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
13 сентября 2021 г. 20:00:18
00:26:11
Яндекс.Метрика