This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

A helper mocking function to mask ImportError s on a scoped code. Failed imports will be ignored, unless specified by the do_not_mock argument.

Installation

Using pip: pip install mock-import

Usage

Import:
>>> from mock_import import mock_import
Mocking import for a code block:
>>> with mock_import():
...     import no_such_module  # Won't raise ImportError
...     no_such_module.no_such_function()  # Won't raise AttributeError
Mocking import as a decorator:
>>> @mock_import()
... def method():
...     import no_such_module  # Won't raise ImportError
...     no_such_module.no_such_function()  # Won't raise AttributeError
>>>     import no_such_module  # raises ImportError
Making an exception:
>>> with mock_import(do_not_mock='no_such_module'):
...     import no_such_other_module  # Won't raise ImportError
...     import no_such_module  # Will raise ImportError
>>> with mock_import(do_not_mock=['nsm1', 'nsm2']):
...     import nsm  # Won't raise ImportError
...     import nsm1  # Will raise ImportError
...     import nsm2  # Will raise ImportError
Release History

Release History

0.0.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
mock-import-0.0.3.tar.gz (1.8 kB) Copy SHA256 Checksum SHA256 Source Sep 16, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting