Byte Ebi's Logo

Byte Ebi 🍀

A Bit everyday A Byte every week

[Pytest 101] 03 Mock SQL Query

Free your unit tests from database dependencies using mocks.

Ray

With mock objects, we can simulate database operations without actually connecting to a real database.
This means we don’t need to prepare a dedicated test database or worry about cleaning it up after tests.

[Pytest 101] 02 Basic Usage of Mock

How to use Mock to simulate behavior, raise exceptions, and test side effects.

Ray

After covering the basic tools, this article demonstrates how to use mocks effectively in Pytest.
Mocks allow us to replace the logic of real functions to simulate different scenarios and write more precise unit tests.
We’ll walk through examples of mocking functions, simulating errors, and even handling external dependencies like Redis.

[Pytest 101] 01 Introduction to Pytest & Mock

An introduction to Pytest and the core concepts of Mock

Ray

Writing unit tests is a well-known best practice in software development, but actually getting started often feels overwhelming.
Where do you begin? What tools should you use? And how do you use them?
For beginners, these first steps can easily become roadblocks.

The Gatekeeper Before Your Git Commits: Pre-commit

A handy tool to auto-check code quality and make every Git commit more reliable.

Ray

Make your Git commits safer! No complex setup required. Just install and commit with confidence.
Use pre-commit to automatically run format checks and tests before committing.
Easy to install and configure. Instantly improve your code quality.

Setting up Python Development Environment

Setting up a Python development environment on Mac

Ray

This is my first time using Python in a work environment, so I’m documenting the environment setup. Many of these packages are new to me, not having used them when I was self-learning a few years ago. I guess that reveals how long it’s been since I touched Python!

TypeScript Generics

Using TypeScript generics to write reusable and type-safe code

Ray

Introduces TypeScript generics, demonstrating how to enhance code reusability by defining flexible methods, interfaces, and classes that adapt to different types.

Recent Posts

Categories

Tags