Add import monkey patch function

This commit is contained in:
Jason Paryani
2013-09-01 21:31:39 -07:00
parent 1317527893
commit 5600f9939a
2 changed files with 99 additions and 1 deletions

View File

@@ -53,3 +53,16 @@ def test_failed_import():
with pytest.raises(ValueError):
bar.foo = foo
def test_add_import_hook():
capnp.add_import_hook([this_dir])
import addressbook
addressbook.AddressBook.new_message()
def test_remove_import_hook():
capnp.add_import_hook([this_dir])
capnp.remove_import_hook()
with pytest.raises(ImportError):
import addressbook