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 | |
Health | |
Repository | |
Publishers | |
Activity |
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
- Joel Lefkowitz - Initial work - Joel Lefkowitz
Remarks
Lots of love to the open source community!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fake_module-1.0.0.tar.gz
.
File metadata
- Download URL: fake_module-1.0.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 680b64d1abb8197311b68aaa6c7d63e8be567ec01ff202d229f1a301a863a1a1 |
|
MD5 | b9d5c37fb703d7d462cc8cc2b9750b31 |
|
BLAKE2b-256 | 75d0e337be780281d79d7726ac2a3ba6217601983d6242734876ae50c370452c |
File details
Details for the file fake_module-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: fake_module-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cf7fb4b1c483afdd3f29a9229321e8f70ef7573d54c8495f0247fa6a3b66a57 |
|
MD5 | 9e2551bb3a9687b630be78a03fef2966 |
|
BLAKE2b-256 | 66bb9041ff8eb80a8f43fb6760f0ca725766b840bc812af83a3a4ecd709481ce |