Test changes to Actually Portable Python (#240)

- Add missing `os.pipe` and `os.getuid`
- Commented out _dummy_thread from Lib/threading.py so tests
  don't simulate multi-threading and waste time/error out
- Revert test_hashlib to avoid blake2
This commit is contained in:
Gautham 2021-08-13 14:54:43 +05:30 committed by GitHub
parent a22f0736d8
commit 1aa0df696c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 3 deletions

View file

@ -342,6 +342,7 @@ class Regrtest:
and len(self.good) > 1): and len(self.good) > 1):
print("All", end=' ') print("All", end=' ')
print(count(len(self.good), "test"), "OK.") print(count(len(self.good), "test"), "OK.")
printlist(self.good)
if self.ns.print_slow: if self.ns.print_slow:
self.test_times.sort(reverse=True) self.test_times.sort(reverse=True)

View file

@ -104,7 +104,10 @@ consts: ('None',)
import inspect import inspect
import sys import sys
try:
import threading import threading
except ImportError as e:
threading = None
import unittest import unittest
import weakref import weakref
try: try:

View file

@ -10,7 +10,6 @@ import py_compile
import random import random
import stat import stat
import sys import sys
import threading
import time import time
import unittest import unittest
import unittest.mock as mock import unittest.mock as mock
@ -28,6 +27,10 @@ from test.support import (
from test.support import script_helper from test.support import script_helper
from test.test_importlib.util import uncache from test.test_importlib.util import uncache
try:
import threading
except ImportError as e:
threading = None
skip_if_dont_write_bytecode = unittest.skipIf( skip_if_dont_write_bytecode = unittest.skipIf(
sys.dont_write_bytecode, sys.dont_write_bytecode,
@ -365,6 +368,7 @@ class ImportTests(unittest.TestCase):
with self.assertRaises(AttributeError): with self.assertRaises(AttributeError):
os.does_not_exist os.does_not_exist
@unittest.skipUnless(threading != None, "concurrency requires threading")
def test_concurrency(self): def test_concurrency(self):
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'data')) sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'data'))
try: try:

View file

@ -1,7 +1,10 @@
"""Thread module emulating a subset of Java's threading model.""" """Thread module emulating a subset of Java's threading model."""
import sys as _sys import sys as _sys
import _dummy_thread as _thread import _thread
# if you REALLY need threading for ensurepip or something
# use _dummy_thread below instead of _thread
# import _dummy_thread as _thread
from time import monotonic as _time from time import monotonic as _time
from traceback import format_exc as _format_exc from traceback import format_exc as _format_exc

View file

@ -446,6 +446,9 @@
/* Define to 1 if you have the `gettimeofday' function. */ /* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1 #define HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the `getuid' function. */
#define HAVE_GETUID 1
/* Define to 1 if you have the `getwd' function. */ /* Define to 1 if you have the `getwd' function. */
/* #undef HAVE_GETWD */ /* #undef HAVE_GETWD */
@ -654,6 +657,9 @@
/* Define to 1 if you have the `pause' function. */ /* Define to 1 if you have the `pause' function. */
#define HAVE_PAUSE 1 #define HAVE_PAUSE 1
/* Define to 1 if you have the `pipe' function. */
#define HAVE_PIPE 1
/* Define to 1 if you have the `pipe2' function. */ /* Define to 1 if you have the `pipe2' function. */
#define HAVE_PIPE2 1 #define HAVE_PIPE2 1