Skip to content

Commit 898037a

Browse files
committed
Skip native datetime subclass test in managed mode
1 parent 041cb87 commit 898037a

File tree

2 files changed

+29
-26
lines changed

2 files changed

+29
-26
lines changed

graalpython/com.oracle.graal.python.test/src/tests/cpyext/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848

4949
GRAALPYTHON = sys.implementation.name == "graalpy"
5050

51+
IS_MANAGED_LAUNCHER = not GRAALPYTHON or __graalpython__.is_managed_launcher()
5152

5253
def assert_raises(err, fn, *args, **kwargs):
5354
raised = False

graalpython/com.oracle.graal.python.test/src/tests/cpyext/test_datetime.py

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
# SOFTWARE.
3939
import datetime
4040

41-
from . import CPyExtType, CPyExtTestCase, CPyExtFunction, unhandled_error_compare, is_native_object
41+
from . import CPyExtType, CPyExtTestCase, CPyExtFunction, unhandled_error_compare, is_native_object, IS_MANAGED_LAUNCHER
4242

4343
__dir__ = __file__.rpartition("/")[0]
4444

@@ -618,28 +618,30 @@ def test_write_and_invoke_member(self):
618618
assert tester.getDate() == "foo"
619619

620620

621-
class TestNativeSubclasses:
622-
def test_time(self):
623-
for t in (NativeTimeSubclass, ManagedNativeTimeSubclass):
624-
x = t(hour=6)
625-
assert is_native_object(x)
626-
assert x.hour == 6
627-
628-
def test_date(self):
629-
for t in (NativeDateSubclass, ManagedNativeDateSubclass):
630-
x = t(1992, 4, 11)
631-
assert is_native_object(x)
632-
assert x.day == 11
633-
634-
def test_datetime(self):
635-
for t in (NativeDateTimeSubclass, ManagedNativeDateTimeSubclass):
636-
x = t(1992, 4, 11, hour=13)
637-
assert is_native_object(x)
638-
assert x.day == 11
639-
assert x.hour == 13
640-
641-
def test_timedelta(self):
642-
for t in (NativeDeltaSubclass, ManagedNativeDeltaSubclass):
643-
x = t(hours=6)
644-
assert is_native_object(x)
645-
assert x.seconds == 21600
621+
# GR-47546: Native subclasses of managed types don't work in managed mode
622+
if not IS_MANAGED_LAUNCHER:
623+
class TestNativeSubclasses:
624+
def test_time(self):
625+
for t in (NativeTimeSubclass, ManagedNativeTimeSubclass):
626+
x = t(hour=6)
627+
assert is_native_object(x)
628+
assert x.hour == 6
629+
630+
def test_date(self):
631+
for t in (NativeDateSubclass, ManagedNativeDateSubclass):
632+
x = t(1992, 4, 11)
633+
assert is_native_object(x)
634+
assert x.day == 11
635+
636+
def test_datetime(self):
637+
for t in (NativeDateTimeSubclass, ManagedNativeDateTimeSubclass):
638+
x = t(1992, 4, 11, hour=13)
639+
assert is_native_object(x)
640+
assert x.day == 11
641+
assert x.hour == 13
642+
643+
def test_timedelta(self):
644+
for t in (NativeDeltaSubclass, ManagedNativeDeltaSubclass):
645+
x = t(hours=6)
646+
assert is_native_object(x)
647+
assert x.seconds == 21600

0 commit comments

Comments
 (0)