1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
# This is a short test to see what happens when we import using star.
#
# Unfortunately this can only be done from a module level so we
# will need to include a special module for this test.
#
# When we start the test late2.jar will not be in the current classpath.
# But we will add it later and make sure the directory updates for us.
import jpype
# import with star the first time
from org.jpype import * # type: ignore
try:
# This should not be found
late2.Test() # type: ignore[name-defined]
raise ImportError("late was already found")
except NameError:
pass
# Path is relative to this module
jpype.addClassPath("../jar/late/late2.jar")
# Second import
if True:
from org.jpype import * # type: ignore[name-defined]
# This time it should work
t = late2.Test() # type: ignore[name-defined]
|