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):
print("All", end=' ')
print(count(len(self.good), "test"), "OK.")
printlist(self.good)
if self.ns.print_slow:
self.test_times.sort(reverse=True)

View file

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

View file

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

View file

@ -1,7 +1,10 @@
"""Thread module emulating a subset of Java's threading model."""
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 traceback import format_exc as _format_exc

View file

@ -446,6 +446,9 @@
/* Define to 1 if you have the `gettimeofday' function. */
#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. */
/* #undef HAVE_GETWD */
@ -654,6 +657,9 @@
/* Define to 1 if you have the `pause' function. */
#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 HAVE_PIPE2 1