Skip to content

Commit b25be74

Browse files
committed
Use posix module in the tests only if available
1 parent 8804ae2 commit b25be74

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@
4040
import re
4141
from inspect import Parameter
4242
import hashlib
43-
import posix
43+
try:
44+
import posix
45+
except ModuleNotFoundError as e:
46+
posix = None
4447

4548

4649
TEST_CASES = [
@@ -54,11 +57,6 @@
5457
(hashlib.md5, '($module, /, string=b\'\', *, usedforsecurity=True)',
5558
[('string', Parameter.POSITIONAL_OR_KEYWORD),
5659
('usedforsecurity', Parameter.KEYWORD_ONLY)]),
57-
(posix.open, '($module, /, path, flags, mode=511, *, dir_fd=None)',
58-
[('path', Parameter.POSITIONAL_OR_KEYWORD),
59-
('flags', Parameter.POSITIONAL_OR_KEYWORD),
60-
('mode', Parameter.POSITIONAL_OR_KEYWORD),
61-
('dir_fd', Parameter.KEYWORD_ONLY)]),
6260
(abs, '($module, x, /)',
6361
[('x', Parameter.POSITIONAL_ONLY)]),
6462
(pow, '($module, /, base, exp, mod=None)',
@@ -67,6 +65,14 @@
6765
('mod', Parameter.POSITIONAL_OR_KEYWORD)]),
6866
]
6967

68+
if posix:
69+
TEST_CASES += [
70+
(posix.open, '($module, /, path, flags, mode=511, *, dir_fd=None)',
71+
[('path', Parameter.POSITIONAL_OR_KEYWORD),
72+
('flags', Parameter.POSITIONAL_OR_KEYWORD),
73+
('mode', Parameter.POSITIONAL_OR_KEYWORD),
74+
('dir_fd', Parameter.KEYWORD_ONLY)])]
75+
7076

7177
def normalize_signature_text(text):
7278
# For the time being:

0 commit comments

Comments
 (0)