Skip to content

Commit 9979be0

Browse files
committed
fix test_imports: prevent ide's from optimising out unused imports
1 parent 503c703 commit 9979be0

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_imports.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,37 @@
4242

4343
sys.path.append(sys._getframe().f_code.co_filename.rpartition("/")[0])
4444

45+
4546
def test_relative_import():
46-
pass
47+
# this is to prevent ides from optimising out the unused import
48+
try:
49+
import package
50+
except Exception as e:
51+
raise e
4752

4853

4954
def test_dotted_import():
50-
pass
55+
# this is to prevent ides from optimising out the unused import
56+
try:
57+
import package.moduleY
58+
except Exception as e:
59+
raise e
5160

5261

5362
def test_recursive_import():
54-
pass
63+
# this is to prevent ides from optimising out the unused import
64+
try:
65+
import package.moduleRecursive
66+
except Exception as e:
67+
raise e
5568

5669

5770
def test_recursive_import2():
58-
pass
71+
# this is to prevent ides from optimising out the unused import
72+
try:
73+
import package.moduleRecursive2
74+
except Exception as e:
75+
raise e
5976

6077

6178
def test_import_star_has_to_be_module():

0 commit comments

Comments
 (0)