Skip to main content

Yet another mocking library

Project description

Mock The Python

What is it?

A library that makes mocking in Python better by building on type of Python's built in mock library.

How?

Currently, just by allowing members of modules which are being patched to be patched by using references to the actual members, instead of bare strings.

Here's an example:

from mock_the_python.mock_path import at
from unittest.mock import patch

import another_module.module_under_test
from another_module.module_under_test import bacon

patch(at(another_module.module_under_test).member(bacon), return_value="mmmm, bacon")

Now you can freely rename bacon to sausage without worrying about whether or not your refactoring tools will find string references, and your tests will still pass. Groovy.

More features will be added to this library

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mock_the_python-0.1.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mock_the_python-0.1.1-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file mock_the_python-0.1.1.tar.gz.

File metadata

  • Download URL: mock_the_python-0.1.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.10.12 Linux/6.8.0-47-generic

File hashes

Hashes for mock_the_python-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ee3c9dc66cb5dcc8a309978123f85d89b64bf77827a5e98eee800cfb42cd85a8
MD5 8d650324ac23fab682b3d752706010fd
BLAKE2b-256 7053905f7586b6a3c4c2581639eb39da772f3099b47885b198be0ab097dcfe0d

See more details on using hashes here.

File details

Details for the file mock_the_python-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mock_the_python-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.10.12 Linux/6.8.0-47-generic

File hashes

Hashes for mock_the_python-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2b4bdde8a70c8353abef15730b7ef4ac624570e3b930213caf96787798fca2fa
MD5 e39db1782ccef4483eeb1df958f67e33
BLAKE2b-256 1c4aa5e3834cc885318b54bf7887a335f8c05f91c99d9b343b5aae40c81395de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page