Add import monkey patch function
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user