Skip to main content

Convenient approach to monkey patching.

Project description

Gorilla is a library that provides a convenient approach to monkey patching.

Defining a function needle() as being an extension for a module guineapig is as easy as:

>>> import gorilla
>>> import guineapig
>>> @gorilla.patch(guineapig)
... def needle():
...     print("awesome")

Marking a class GuineaPig to be patched with a class of our own is no sweat either:

>>> import gorilla
>>> import guineapig
>>> @patch(guineapig, name='GuineaPig')
... class Needle(object):
...     def needle(self, arg):
...         print("Patching %s is awesome" % self.__class__.__name__)
...
...     @classmethod
...     def classic_needle(cls):
...     print("Patching %s is awesome" % cls.__name__)

See the overview and tutorial sections of the documentation for more details.

Documentation

Read the documentation online at <http://gorilla.readthedocs.org> or check their source from the doc folder.

The documentation can be built in different formats using Sphinx.

Running the Tests

A suite of unit tests is available from the tests directory. You can run it by firing:

$ python tests/run.py

To run specific tests, it is possible to pass names to match in the command line.

$ python tests/run.py TestCase test_my_code

This command will run all the tests within the TestCase class as well as the individual tests which contains test_my_code in their name.

Get the Source

The source code is available from the GitHub project page.

Contributing

Found a bug or got a feature request? Don’t keep it for yourself, log a new issue on GitHub.

Author

Christopher Crouzet <christophercrouzet.com>

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

gorilla-0.1.0.tar.gz (84.7 kB view hashes)

Uploaded Source

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