Skip to content

Commit

Permalink
Unit test to check that dylink's module cache works under repyportabi…
Browse files Browse the repository at this point in the history
…lity. See #28 for details.
  • Loading branch information
aaaaalbert committed Jun 20, 2014
1 parent 91b0ee9 commit 61fd57e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/ut_portability_catch_nestedimported_exception.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""
Verify that we can catch an excpetion defined in an imported library
and raised in another.
"""
#pragma out Successfully caught Lib1Error().

from repyportability import *
add_dy_support(locals())

lib1 = dy_import_module("portability_testlib1.r2py") # defines the exception
lib2 = dy_import_module("portability_testlib2.r2py") # raises it

try:
lib2.raise_lib1error()
except lib1.Lib1Error:
log("Successfully caught Lib1Error().\n")
except Exception, e:
log("Error: Expected Lib1Error() with id " + str(id(lib1.Lib1Error)) +
" but caught '" + repr(e) + "' with id " + str(id(e)) + " \n")

0 comments on commit 61fd57e

Please sign in to comment.