Skip to main content

Globally replace a module with a configurable fake.

Project description

Mock file tree

Globally replace a module with a configurable fake.

Status

Source Shields
Project release license lines languages
Health codacy readthedocs github_review codacy_coverage
Repository issues issues_closed pulls pulls_closed
Publishers pypi python_versions pypi_downloads
Activity contributors monthly_commits last_commit

Installing

pip install fake-module

Usage

You can purge all of a module's members inside a context manager:

from fake_module import FakeModule

with FakeModule("colorsys"):
     colorsys.rgb_to_hls()

... AttributeError

Or create a fake globally:

import colorsys
from fake_module import FakeModule

fake = FakeModule("colorsys")
fake.purge()
setattr(fake, "rgb_to_hls", 1)

colorsys.rgb_to_hls

1

Tests

To run unit tests and generate a coverage report:

grunt test

Documentation

This repository's documentation is hosted on readthedocs.

Tooling

To run linters:

grunt lint

To run formatters:

grunt format

Continuous integration

This repository uses github actions to lint and test each commit. Formatting tasks and writing/generating documentation must be done before committing new code.

Versioning

This repository adheres to semantic versioning standards. For more information on semantic versioning visit SemVer.

Bump2version is used to version and tag changes. For example:

bump2version patch

Changelog

Please read this repository's CHANGELOG for details on changes that have been made.

Contributing

Please read this repository's guidelines on CONTRIBUTING for details on our code of conduct and the process for submitting pull requests.

Contributors

Buy Me A Coffee

Remarks

Lots of love to the open source community!

Be kind

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

fake_module-1.0.0.tar.gz (5.3 kB view hashes)

Uploaded Source

Built Distribution

fake_module-1.0.0-py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 3

Supported by

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