pyodide/cpython/patches/0007-testing.patch

141 lines
5.2 KiB
Diff
Raw Normal View History

From 0eb0ea9aeb5a5cfdceb35547dd1a97d73914338b Mon Sep 17 00:00:00 2001
From: Michael Droettboom <mdboom@gmail.com>
Date: Sun, 5 Jul 2020 19:56:47 +0200
Subject: [PATCH] testing
---
Lib/platform.py | 2 +-
Lib/test/libregrtest/main.py | 4 +++-
Lib/test/support/script_helper.py | 5 +++++
Lib/test/test_cgi.py | 1 +
Lib/test/test_fcntl.py | 2 ++
Lib/test/test_gzip.py | 2 ++
Lib/test/test_itertools.py | 1 +
7 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/Lib/platform.py b/Lib/platform.py
index 0bce438..8fdfe05 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -614,7 +614,7 @@ def _syscmd_file(target, default=''):
default in case the command should fail.
"""
- if sys.platform in ('dos', 'win32', 'win16'):
+ if sys.platform in ('dos', 'win32', 'win16', 'emscripten'):
# XXX Others too ?
return default
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index e20bf9a..18f62f4 100644
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -639,7 +639,9 @@ class Regrtest:
except SystemExit as exc:
# bpo-38203: Python can hang at exit in Py_Finalize(), especially
# on threading._shutdown() call: put a timeout
- faulthandler.dump_traceback_later(EXIT_TIMEOUT, exit=True)
+
+ # Skipping, pyodide doesn't support threading.
+ # faulthandler.dump_traceback_later(EXIT_TIMEOUT, exit=True)
sys.exit(exc.code)
diff --git a/Lib/test/support/script_helper.py b/Lib/test/support/script_helper.py
index 37e576d..d470e4a 100644
--- a/Lib/test/support/script_helper.py
+++ b/Lib/test/support/script_helper.py
@@ -9,6 +9,7 @@ import os.path
import subprocess
import py_compile
import zipfile
+import unittest
from importlib.util import source_from_cache
from test.support import make_legacy_pyc
@@ -34,6 +35,8 @@ def interpreter_requires_environment():
situation. PYTHONPATH or PYTHONUSERSITE are other common environment
variables that might impact whether or not the interpreter can start.
"""
+ raise unittest.SkipTest('no subprocess')
+
global __cached_interp_requires_environment
if __cached_interp_requires_environment is None:
# If PYTHONHOME is set, assume that we need it
@@ -171,6 +174,8 @@ def spawn_python(*args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **kw):
kw is extra keyword args to pass to subprocess.Popen. Returns a Popen
object.
"""
+ raise unittest.SkipTest("no subprocess")
+
cmd_line = [sys.executable]
if not interpreter_requires_environment():
cmd_line.append('-E')
diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py
index 4e1506a..8c02cdb 100644
--- a/Lib/test/test_cgi.py
+++ b/Lib/test/test_cgi.py
@@ -221,6 +221,7 @@ Content-Length: 3
self.assertEqual(fs.getvalue(key), expect_val[0])
def test_log(self):
+ raise unittest.SkipTest('known pyodide failure')
cgi.log("Testing")
cgi.logfp = StringIO()
diff --git a/Lib/test/test_fcntl.py b/Lib/test/test_fcntl.py
index 9ab68c6..3e74849 100644
--- a/Lib/test/test_fcntl.py
+++ b/Lib/test/test_fcntl.py
@@ -155,6 +155,7 @@ class TestFcntl(unittest.TestCase):
@unittest.skipIf(platform.system() == "AIX", "AIX returns PermissionError")
def test_lockf_exclusive(self):
+ raise unittest.SkipTest('threading not supported')
self.f = open(TESTFN, 'wb+')
cmd = fcntl.LOCK_EX | fcntl.LOCK_NB
fcntl.lockf(self.f, cmd)
@@ -166,6 +167,7 @@ class TestFcntl(unittest.TestCase):
@unittest.skipIf(platform.system() == "AIX", "AIX returns PermissionError")
def test_lockf_share(self):
+ raise unittest.SkipTest('threading not supported')
self.f = open(TESTFN, 'wb+')
cmd = fcntl.LOCK_SH | fcntl.LOCK_NB
fcntl.lockf(self.f, cmd)
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index 1af23c6..045b4c7 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -743,6 +743,7 @@ class TestCommandLine(unittest.TestCase):
data = b'This is a simple test with gzip'
def test_decompress_stdin_stdout(self):
+ raise unittest.SkipTest('no subprocess')
with io.BytesIO() as bytes_io:
with gzip.GzipFile(fileobj=bytes_io, mode='wb') as gzip_file:
gzip_file.write(self.data)
@@ -779,6 +780,7 @@ class TestCommandLine(unittest.TestCase):
@create_and_remove_directory(TEMPDIR)
def test_compress_stdin_outfile(self):
+ raise unittest.SkipTest('no subprocess')
args = sys.executable, '-m', 'gzip'
with Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) as proc:
out, err = proc.communicate(self.data)
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index 7101264..bf359a0 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -1513,6 +1513,7 @@ class TestBasicOps(unittest.TestCase):
next(a)
def test_tee_concurrent(self):
+ raise unittest.SkipTest('threading not supported')
start = threading.Event()
finish = threading.Event()
class I:
--
2.17.1