fake-module

Globally replace a module with a configurable fake.

MIT License

Downloads
62
Stars
2
Committers
1

Fake module

Globally replace a module with a configurable fake.

Installing

pip install fake-module

Documentation

Documentation and more detailed examples are hosted on Github Pages.

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

Tooling

Dependencies

To install dependencies:

yarn install
pip install .[all]

Tests

To run tests:

thx test

Documentation

To generate the documentation locally:

thx docs

Linters

To run linters:

thx lint

Formatters

To run formatters:

thx format

Contributing

Please read this repository's Code of Conduct which outlines our collaboration standards and the Changelog for details on breaking changes that have been made.

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

Contributors

Remarks

Lots of love to the open source community!