File: importstar.py

package info (click to toggle)
python-jpype 1.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,872 kB
  • sloc: python: 18,369; cpp: 17,718; java: 8,254; xml: 1,305; makefile: 152; sh: 32
file content (28 lines) | stat: -rw-r--r-- 724 bytes parent folder | download | duplicates (2)
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 *

try:
    # This should not be found
    late2.Test()
    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 *

# This time it should work
t = late2.Test()