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