Skip to content

Commit 0309ca3

Browse files
committed
patch out unsupported core module usage (socket/threading/subprocess/etc) to get basic test.support to import and run
1 parent a1ac2c8 commit 0309ca3

File tree

8 files changed

+34
-33
lines changed

8 files changed

+34
-33
lines changed

graalpython/lib-python/3/logging/handlers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
2323
To use, simply 'import logging.handlers' and log away!
2424
"""
25-
# TODO: reenable me once socket is supported
25+
# TODO: reenable me once socket is supported (GR-9140)
2626
# import logging, socket, os, pickle, struct, time, re
2727
import logging, os, pickle, struct, time, re
2828
from stat import ST_DEV, ST_INO, ST_MTIME
29-
# TODO: reenable me once queue and threading is supported
29+
# TODO: reenable me once queue and threading is supported (GR-9144)
3030
# import queue
31-
# TODO: reenable me once threading is supported
31+
# TODO: reenable me once threading is supported (GR-9144)
3232
# try:
3333
# import threading
3434
# except ImportError: #pragma: no cover

graalpython/lib-python/3/pdb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
import code
7777
import glob
7878
import pprint
79-
# TODO: reenable me when signal is suported
79+
# TODO: reenable me when signal is suported (GR-9136)
8080
# import signal
8181
import inspect
8282
import traceback

graalpython/lib-python/3/platform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
__version__ = '1.0.8'
114114

115115
import collections
116-
# TODO: reenable me once subprocess is supported
116+
# TODO: reenable me once subprocess is supported (GR-9141)
117117
# import sys, os, re, subprocess
118118
import sys, os, re
119119

graalpython/lib-python/3/sysconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ def _generate_posix_vars():
428428

429429
def _init_posix(vars):
430430
"""Initialize the module as appropriate for POSIX systems."""
431-
# TODO: reneable me once we know what goes on in here
431+
# TODO: reneable me once we know what goes on in here (GR-9137)
432432
# name = _get_sysconfigdata_name()
433433
# _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
434434
# build_time_vars = _temp.build_time_vars

graalpython/lib-python/3/test/support/__init__.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,32 @@
1313
import importlib
1414
import importlib.util
1515
import logging.handlers
16-
# TODO: reenable me once supported
16+
# TODO: reenable me once supported (GR-9138)
1717
# import nntplib
1818
import os
19-
# TODO: reenable me once supported
20-
# import platform
19+
import platform
2120
import re
22-
# TODO: reenable me once supported
21+
# TODO: reenable me once supported (GR-9139)
2322
# import shutil
24-
# TODO: reenable me once supported
23+
# TODO: reenable me once supported (GR-9140)
2524
# import socket
2625
import stat
2726
import struct
28-
# TODO: reenable me once supported
27+
# TODO: reenable me once supported (GR-9141)
2928
# import subprocess
3029
import sys
3130
import sysconfig
32-
# TODO: reenable me once supported
31+
# TODO: reenable me once supported (GR-9142)
3332
# import tempfile
3433
import time
3534
import types
3635
import unittest
37-
# TODO: reenable me once supported
36+
# TODO: reenable me once supported (GR-9143)
3837
# import urllib.error
3938
import warnings
4039

4140

42-
# TODO: reenable me once supported
41+
# TODO: reenable me once supported (GR-9144)
4342
# try:
4443
# import _thread, threading
4544
# except ImportError:
@@ -48,36 +47,36 @@
4847
_thread = None
4948
threading = None
5049

51-
# TODO: reenable me once supported
50+
# TODO: reenable me once supported (GR-9145)
5251
# try:
5352
# import multiprocessing.process
5453
# except ImportError:
5554
# multiprocessing = None
5655
multiprocessing = None
5756

58-
# TODO: reenable me once supported
57+
# TODO: reenable me once supported (GR-9146)
5958
# try:
6059
# import zlib
6160
# except ImportError:
6261
# zlib = None
6362
zlib = None
6463

65-
# TODO: reenable me once supported
64+
# TODO: reenable me once supported (GR-9147)
6665
# try:
6766
# import gzip
6867
# except ImportError:
6968
# gzip = None
7069
gzip = None
7170

7271

73-
# TODO: reenable me once supported
72+
# TODO: reenable me once supported (GR-9148)
7473
# try:
7574
# import bz2
7675
# except ImportError:
7776
# bz2 = None
7877
bz2 = None
7978

80-
# TODO: reenable me once supported
79+
# TODO: reenable me once supported (GR-9149)
8180
# try:
8281
# import lzma
8382
# except ImportError:
@@ -633,7 +632,7 @@ def wrapper(*args, **kw):
633632
HOSTv6 = "::1"
634633

635634

636-
# TODO: revert me once socket is implemented
635+
# TODO: revert me once socket is implemented (GR-9140)
637636
# def find_unused_port(family=socket.AF_INET, socktype=socket.SOCK_STREAM):
638637
def find_unused_port(family, socktype):
639638
"""Returns an unused port that should be suitable for binding. This is
@@ -743,7 +742,7 @@ def bind_unix_socket(sock, addr):
743742
sock.close()
744743
raise unittest.SkipTest('cannot bind AF_UNIX sockets')
745744

746-
# TODO: reenable me once socket is implemented
745+
# TODO: reenable me once socket is implemented (GR-9140)
747746
# def _is_ipv6_enabled():
748747
# """Check whether IPv6 is enabled on this host."""
749748
# if socket.has_ipv6:
@@ -804,7 +803,7 @@ def dec(*args, **kwargs):
804803

805804
is_jython = sys.platform.startswith('java')
806805

807-
# TODO: reenable me once sysconfig is properly implemented
806+
# TODO: reenable me once sysconfig is properly implemented (GR-9150)
808807
# _ANDROID_API_LEVEL = sysconfig.get_config_var('ANDROID_API_LEVEL')
809808
# is_android = (_ANDROID_API_LEVEL is not None and _ANDROID_API_LEVEL > 0)
810809
is_android = False

graalpython/lib-python/3/test/test_builtin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1842,7 +1842,7 @@ class B:
18421842

18431843

18441844
def load_tests(loader, tests, pattern):
1845-
# TODO: revertme once doctest is supported (once io can read text files)
1845+
# TODO: revertme once doctest is supported (once io can read text files) (GR-9151)
18461846
# from doctest import DocTestSuite
18471847
# tests.addTest(DocTestSuite(builtins))
18481848
return tests

graalpython/lib-python/3/test/test_math.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,7 @@ def test_fractions(self):
14111411

14121412

14131413
def test_main():
1414-
# TODO: revertme once doctest is supported (once io can read text files)
1414+
# TODO: revertme once doctest is supported (once io can read text files) (GR-9151)
14151415
# from doctest import DocFileSuite
14161416
suite = unittest.TestSuite()
14171417
suite.addTest(unittest.makeSuite(MathTests))

graalpython/lib-python/3/unittest/case.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -991,14 +991,16 @@ def assertSequenceEqual(self, seq1, seq2, msg=None, seq_type=None):
991991
except (TypeError, IndexError, NotImplementedError):
992992
differing += ('Unable to index element %d '
993993
'of second %s\n' % (len1, seq_type_name))
994-
standardMsg = differing
995-
diffMsg = '\n' + '\n'.join(
996-
difflib.ndiff(pprint.pformat(seq1).splitlines(),
997-
pprint.pformat(seq2).splitlines()))
998-
999-
standardMsg = self._truncateMessage(standardMsg, diffMsg)
1000-
msg = self._formatMessage(msg, standardMsg)
1001-
self.fail(msg)
994+
# standardMsg = differing
995+
# diffMsg = '\n' + '\n'.join(
996+
# difflib.ndiff(pprint.pformat(seq1).splitlines(),
997+
# pprint.pformat(seq2).splitlines()))
998+
#
999+
# standardMsg = self._truncateMessage(standardMsg, diffMsg)
1000+
# msg = self._formatMessage(msg, standardMsg)
1001+
# self.fail(msg)
1002+
# TODO: reneable me once pformat / difflib work (GR-9152) (GR-9153)
1003+
self.fail(differing)
10021004

10031005
def _truncateMessage(self, message, diff):
10041006
max_diff = self.maxDiff

0 commit comments

Comments
 (0)