How To Install python3-pook on Debian 12

Learn how to install python3-pook on Debian 12 with this tutorial. python3-pook is HTTP traffic mocking and testing made easy (Python 3)

Introduction

In this tutorial we learn how to install python3-pook on Debian 12.

What is python3-pook

python3-pook is:

Versatile, expressive and hackable utility library for HTTP traffic mocking and expectations made easy in Python. Heavily inspired by gock.

Features:

  • Simple, expressive and fluent API.
  • Provides both Pythonic and chainable DSL API styles.
  • Full-featured HTTP response definitions and expectations.
  • Matches any HTTP protocol primitive (URL, method, query params, headers, body…).
  • Full regular expressions capable mock expectations matching.
  • Supports most popular HTTP clients via interceptor adapters.
  • Configurable volatile, persistent or TTL limited mocks.
  • Works with any testing framework/engine (unittest, pytest, nosetests…).
  • First-class JSON & XML support matching and responses.
  • Supports JSON Schema body matching.
  • Works in both runtime and testing environments.
  • Can be used as decorator and/or via context managers.
  • Supports real networking mode with optional traffic filtering.
  • Map/filter mocks easily for generic or custom mock expectations.
  • Custom user-defined mock matcher functions.
  • Simulated raised error exceptions.
  • Network delay simulation (only available for aiohttp).
  • Pluggable and hackable API.
  • Customizable HTTP traffic mock interceptor engine.
  • Supports third-party mocking engines, such as mocket.
  • Fits good for painless test doubles.
  • Does not support WebSocket traffic mocking.
  • Works with Python +2.7 and +3.0 (including PyPy).
  • Dependency-less: just 2 small dependencies for JSONSchema and XML tree comparison.

This package installs the library for Python 3.

There are three methods to install python3-pook on Debian 12. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python3-pook Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python3-pook using apt-get by running the following command:

sudo apt-get -y install python3-pook

Install python3-pook Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python3-pook using apt by running the following command:

sudo apt -y install python3-pook

Install python3-pook Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python3-pook using aptitude by running the following command:

sudo aptitude -y install python3-pook

How To Uninstall python3-pook on Debian 12

To uninstall only the python3-pook package we can use the following command:

sudo apt-get remove python3-pook

Uninstall python3-pook And Its Dependencies

To uninstall python3-pook and its dependencies that are no longer needed by Debian 12, we can use the command below:

sudo apt-get -y autoremove python3-pook

Remove python3-pook Configurations and Data

To remove python3-pook configuration and data from Debian 12 we can use the following command:

sudo apt-get -y purge python3-pook

Remove python3-pook configuration, data, and all of its dependencies

We can use the following command to remove python3-pook configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python3-pook

Dependencies

python3-pook have the following dependencies:

References

Summary

In this tutorial we learn how to install python3-pook package on Debian 12 using different package management tools: apt, apt-get and aptitude.