You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing a unit test to verify dylink's requirement to supply library file names including extensions, see #1317. When testing a "bad" case and trying to catch the RepyImportError that is raised, I don't succeed.
If dylink isn't imported in my test script, then RepyImportError is unknown:
try:
dy_import_module_symbols("nonexistentlibrary")
# Fails with dy_import_module() too!
except RepyImportError:
log("Can catch RepyImportError!\n")
# Result:
# Exception (with type 'exceptions.NameError'): name 'RepyImportError' is not defined
Adding an import at the top, no matter if dy_import_module or the ..._symbols one, still doesn't let me catch the error:
Exception (with class '.RepyImportError'): Failed to locate the module! Module: 'nonexistentlibrary' Cannot openfile non-existent file "nonexistentlibrary" without creating it!
Now RepyImportError inherits from Exception (rather than RepyException which I think should rather be used, see the exception hierarchy), but changing to that base class doesn't help either.
Note: This problem looks similar to one with SocketTimeoutError that Monzur ran into and worked around using a blanket except.
The text was updated successfully, but these errors were encountered:
I should add that in order to enable the dy_import_module* calls in a Repy program, you call the interpreter with dylink.r2py as the program to run, and give it your program's name as the first argument. dylink then reads in the code and does the imports.
Running this way should also add the import error to the context of the user program, not only the import functions.
By the way, the problem Monzur saw is different. It'srelated to repyportability's use of dylink, see SeattleTestbed/portability#28.
I'm writing a unit test to verify dylink's requirement to supply library file names including extensions, see #1317. When testing a "bad" case and trying to catch the RepyImportError that is raised, I don't succeed.
If dylink isn't imported in my test script, then RepyImportError is unknown:
Adding an import at the top, no matter if
dy_import_module
or the..._symbols
one, still doesn't let me catch the error:Now
RepyImportError
inherits fromException
(rather thanRepyException
which I think should rather be used, see the exception hierarchy), but changing to that base class doesn't help either.Note: This problem looks similar to one with
SocketTimeoutError
that Monzur ran into and worked around using a blanket except.The text was updated successfully, but these errors were encountered: