Commit 2690ece8 authored by Michael Droettboom's avatar Michael Droettboom

Merge branch 'cpython-tests'

parents 1cc1ba48 8b1c538e
...@@ -60,7 +60,7 @@ build/test.html: src/test.html ...@@ -60,7 +60,7 @@ build/test.html: src/test.html
test: all build/test.html test: all build/test.html
py.test test -v -x py.test test -v
benchmark: all build/test.html benchmark: all build/test.html
......
...@@ -15,6 +15,8 @@ _heapq _heapqmodule.c ...@@ -15,6 +15,8 @@ _heapq _heapqmodule.c
_json _json.c _json _json.c
_csv _csv.c _csv _csv.c
unicodedata unicodedata.c unicodedata unicodedata.c
_pickle _pickle.c
parser parsermodule.c
_socket socketmodule.c _socket socketmodule.c
select selectmodule.c select selectmodule.c
...@@ -24,6 +26,8 @@ binascii binascii.c ...@@ -24,6 +26,8 @@ binascii binascii.c
zlib zlibmodule.c -IModules/zlib zlib/adler32.c zlib/crc32.c zlib/deflate.c zlib/infback.c zlib/inffast.c zlib/inflate.c zlib/inftrees.c zlib/trees.c zlib/zutil.c zlib/compress.c zlib/uncompr.c zlib/gzclose.c zlib/gzlib.c zlib/gzread.c zlib/gzwrite.c zlib zlibmodule.c -IModules/zlib zlib/adler32.c zlib/crc32.c zlib/deflate.c zlib/infback.c zlib/inffast.c zlib/inflate.c zlib/inftrees.c zlib/trees.c zlib/zutil.c zlib/compress.c zlib/uncompr.c zlib/gzclose.c zlib/gzlib.c zlib/gzread.c zlib/gzwrite.c
pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI -DXML_POOR_ENTROPY
_sha1 sha1module.c _sha1 sha1module.c
_sha256 sha256module.c _sha256 sha256module.c
_sha512 sha512module.c _sha512 sha512module.c
......
diff --git a/Lib/platform.py b/Lib/platform.py
index cc2db9870d..ac4e3c538f 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -748,7 +748,7 @@ def _syscmd_uname(option, default=''):
""" Interface to the system's uname command.
"""
- if sys.platform in ('dos', 'win32', 'win16'):
+ if sys.platform in ('dos', 'win32', 'win16', 'emscripten'):
# XXX Others too ?
return default
try:
@@ -771,7 +771,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
target = _follow_symlinks(target)
diff --git a/Lib/test/support/script_helper.py b/Lib/test/support/script_helper.py
index ca5f9c20dd..97934039ee 100644
--- a/Lib/test/support/script_helper.py
+++ b/Lib/test/support/script_helper.py
@@ -11,6 +11,7 @@ import subprocess
import py_compile
import contextlib
import shutil
+import unittest
import zipfile
from importlib.util import source_from_cache
@@ -37,6 +38,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:
# Try running an interpreter with -E to see if it works or not.
@@ -165,6 +168,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, '-E']
cmd_line.extend(args)
# Under Fedora (?), GNU readline can output junk on stderr when initialized,
diff --git a/Lib/test/test_code.py b/Lib/test/test_code.py
index 55faf4c427..b2201c09e7 100644
--- a/Lib/test/test_code.py
+++ b/Lib/test/test_code.py
@@ -104,7 +104,10 @@ consts: ('None',)
import inspect
import sys
-import threading
+try:
+ import threading
+except ImportError:
+ import dummy_threading as threading
import unittest
import weakref
try:
diff --git a/Lib/test/test_import/__init__.py b/Lib/test/test_import/__init__.py
index b73a96f757..0d1c411f9a 100644
--- a/Lib/test/test_import/__init__.py
+++ b/Lib/test/test_import/__init__.py
@@ -10,7 +10,10 @@ import py_compile
import random
import stat
import sys
-import threading
+try:
+ import threading
+except ImportError:
+ import dummy_threading as threading
import time
import unittest
import unittest.mock as mock
...@@ -2,11 +2,11 @@ import lazy_import ...@@ -2,11 +2,11 @@ import lazy_import
print("Setting up lazy importing...") print("Setting up lazy importing...")
# lazy_import.lazy_module("numpy.linalg") lazy_import.lazy_module("numpy.linalg")
lazy_import.lazy_module("numpy.fft") lazy_import.lazy_module("numpy.fft")
# lazy_import.lazy_module("numpy.polynomial") lazy_import.lazy_module("numpy.polynomial")
# lazy_import.lazy_module("numpy.random") lazy_import.lazy_module("numpy.random")
# lazy_import.lazy_module("numpy.ctypeslib") lazy_import.lazy_module("numpy.ctypeslib")
import sys import sys
sys.argv = ['pyodide'] sys.argv = ['pyodide']
test___all__ blake2b # Test modules with a failure reason after their name are skipped.
#
# Reason codes are:
# - platform-specific: This is testing something about a particular platform
# that isn't relevant here
# - audioop: Requires the audioop module
# - floating point: Failures caused by floating-point differences
# - subprocess: Failures caused by no subprocess module. Some of these are
# because the underlying functionality depends on subprocess, and others are
# just a side-effect of the way the test is written. The latter should
# probably be marked as "skip" or rearchitected so we don't have to skip the
# whole module.
# - networking: Fails because it tests low-level networking.
# - unknown encoding: Most of the larger and more rare encodings are excluded
# from the build for size reasons. Python code should just use Unicode, and to
# the extent that obscure codecs are needed, they should be available on the
# Javascript side. Long term plan is to transparently call over to Javascript
# for this stuff.
# - dbm: Failures due to no dbm module
# - _lsprof: Failures due to no _lsprof module
# - strftime: Failures due to differences / shortcomings in WebAssembly's
# implementation of date/time formatting in strftime and strptime
# - permissions: Issues with the test writing to the virtual filesystem
# - locale: Fails due to include locale implementation.
# - crash: The Python interpreter just stopped without a traceback. Will require
# further investigation. This usually seems to be caused by calling into a
# system function that doesn't behave as one would expect.
# - nonsense: This functionality doesn't make sense in this context. Includes
# things like `pip`, `distutils`
test___all__
test___future__ test___future__
test__locale locale test__locale locale
test__opcode test__opcode
...@@ -43,7 +73,7 @@ test_bisect ...@@ -43,7 +73,7 @@ test_bisect
test_bool test_bool
test_buffer test_buffer
test_bufio test_bufio
test_builtin test_builtin floating point
test_bytes test_bytes
test_bz2 test_bz2
test_calendar test_calendar
...@@ -53,51 +83,51 @@ test_cgi ...@@ -53,51 +83,51 @@ test_cgi
test_cgitb test_cgitb
test_charmapcodec test_charmapcodec
test_class test_class
test_cmath cmath test_cmath
test_cmd test_cmd
test_cmd_line test_cmd_line
test_cmd_line_script test_cmd_line_script subprocess
test_code test_code
test_code_module test_code_module
test_codeccallbacks test_codeccallbacks
test_codecencodings_cn test_codecencodings_cn unknown encoding
test_codecencodings_hk test_codecencodings_hk unknown encoding
test_codecencodings_iso2022 test_codecencodings_iso2022 unknown encoding
test_codecencodings_jp test_codecencodings_jp unknown encoding
test_codecencodings_kr test_codecencodings_kr unknown encoding
test_codecencodings_tw test_codecencodings_tw unknown encoding
test_codecmaps_cn test_codecmaps_cn
test_codecmaps_hk test_codecmaps_hk
test_codecmaps_jp test_codecmaps_jp
test_codecmaps_kr test_codecmaps_kr
test_codecmaps_tw test_codecmaps_tw
test_codecs test_codecs unknown encoding
test_codeop test_codeop
test_collections test_collections
test_colorsys test_colorsys
test_compare test_compare
test_compile test_compile
test_compileall test_compileall crash
test_complex test_complex floating point
test_concurrent_futures test_concurrent_futures
test_configparser test_configparser
test_contains test_contains
test_contextlib test_contextlib
test_copy test_copy
test_copyreg test_copyreg dbm
test_coroutines test_coroutines
test_cprofile test_cprofile _lsprof
test_crashers test_crashers
test_crypt test_crypt
test_csv test_csv
test_ctypes test_ctypes
test_curses test_curses
test_datetime test_datetime strftime
test_dbm test_dbm permissions
test_dbm_dumb test_dbm_dumb permissions
test_dbm_gnu test_dbm_gnu
test_dbm_ndbm test_dbm_ndbm
test_decimal test_decimal floating point
test_decorators test_decorators
test_defaultdict test_defaultdict
test_deque test_deque
...@@ -108,37 +138,37 @@ test_dict ...@@ -108,37 +138,37 @@ test_dict
test_dict_version test_dict_version
test_dictcomps test_dictcomps
test_dictviews test_dictviews
test_difflib test_difflib floating point
test_dis test_dis
test_distutils test_distutils crash
test_doctest test_doctest subprocess
test_doctest2 test_doctest2
test_docxmlrpc test_docxmlrpc
test_dtrace test_dtrace platform
test_dummy_thread test_dummy_thread
test_dummy_threading test_dummy_threading
test_dynamic test_dynamic
test_dynamicclassattribute test_dynamicclassattribute
test_eintr test_eintr platform-specific
test_email.test__encoded_words test_email.test__encoded_words
test_email.test__header_value_parser test_email.test__header_value_parser
test_email.test_asian_codecs test_email.test_asian_codecs
test_email.test_contentmanager test_email.test_contentmanager
test_email.test_defect_handling test_email.test_defect_handling
test_email.test_email test_email.test_email unknown encoding
test_email.test_generator test_email.test_generator
test_email.test_headerregistry test_email.test_headerregistry unknown encoding
test_email.test_inversion test_email.test_inversion
test_email.test_message test_email.test_message
test_email.test_parser test_email.test_parser
test_email.test_pickleable test_email.test_pickleable
test_email.test_policy test_email.test_policy
test_email.test_utils test_email.test_utils
test_ensurepip test_ensurepip nonsense
test_enum test_enum
test_enumerate test_enumerate
test_eof test_eof
test_epoll test_epoll crash
test_errno test_errno
test_exception_hierarchy test_exception_hierarchy
test_exception_variations test_exception_variations
...@@ -147,19 +177,19 @@ test_extcall ...@@ -147,19 +177,19 @@ test_extcall
test_faulthandler test_faulthandler
test_fcntl test_fcntl
test_file test_file
test_file_eintr test_file_eintr subprocess
test_filecmp test_filecmp crash
test_fileinput test_fileinput
test_fileio test_fileio
test_finalization test_finalization
test_float test_float floating point
test_flufl test_flufl
test_fnmatch test_fnmatch
test_fork1 test_fork1
test_format test_format floating point
test_fractions test_fractions
test_frame test_frame
test_fstring test_fstring floating point
test_ftplib test_ftplib
test_funcattrs test_funcattrs
test_functools test_functools
...@@ -171,13 +201,13 @@ test_gc ...@@ -171,13 +201,13 @@ test_gc
test_gdb test_gdb
test_generator_stop test_generator_stop
test_generators test_generators
test_genericpath test_genericpath permissions
test_genexps test_genexps
test_getargs2 test_getargs2
test_getopt test_getopt
test_getpass test_getpass permissions
test_gettext test_gettext crash
test_glob test_glob crash
test_global test_global
test_grammar test_grammar
test_grp test_grp
...@@ -190,17 +220,17 @@ test_html ...@@ -190,17 +220,17 @@ test_html
test_htmlparser test_htmlparser
test_http_cookiejar test_http_cookiejar
test_http_cookies test_http_cookies
test_httplib test_httplib socket
test_httpservers test_httpservers
test_idle test_idle
test_imaplib test_imaplib
test_imghdr test_imghdr
test_imp test_imp crash
test_importlib.builtin.test_finder test_importlib.builtin.test_finder
test_importlib.builtin.test_loader test_importlib.builtin.test_loader
test_importlib.extension.test_case_sensitivity test_importlib.extension.test_case_sensitivity
test_importlib.extension.test_finder test_importlib.extension.test_finder crash
test_importlib.extension.test_loader test_importlib.extension.test_loader crash
test_importlib.extension.test_path_hook test_importlib.extension.test_path_hook
test_importlib.frozen.test_finder test_importlib.frozen.test_finder
test_importlib.frozen.test_loader test_importlib.frozen.test_loader
...@@ -214,23 +244,23 @@ test_importlib.import_.test_packages ...@@ -214,23 +244,23 @@ test_importlib.import_.test_packages
test_importlib.import_.test_path test_importlib.import_.test_path
test_importlib.import_.test_relative_imports test_importlib.import_.test_relative_imports
test_importlib.source.test_case_sensitivity test_importlib.source.test_case_sensitivity
test_importlib.source.test_file_loader test_importlib.source.test_file_loader crash
test_importlib.source.test_finder test_importlib.source.test_finder crash
test_importlib.source.test_path_hook test_importlib.source.test_path_hook
test_importlib.source.test_source_encoding test_importlib.source.test_source_encoding crash
test_importlib.test_abc test_importlib.test_abc
test_importlib.test_api test_importlib.test_api crash
test_importlib.test_lazy test_importlib.test_lazy
test_importlib.test_locks test_importlib.test_locks
test_importlib.test_namespace_pkgs test_importlib.test_namespace_pkgs unknown encoding
test_importlib.test_spec test_importlib.test_spec
test_importlib.test_util test_importlib.test_util crash
test_importlib.test_windows test_importlib.test_windows platform-specific
test_index test_index
test_inspect test_inspect crash
test_int test_int
test_int_literal test_int_literal
test_io test_io crash
test_ioctl test_ioctl
test_ipaddress test_ipaddress
test_isinstance test_isinstance
...@@ -252,25 +282,25 @@ test_json.test_recursion ...@@ -252,25 +282,25 @@ test_json.test_recursion
test_json.test_scanstring test_json.test_scanstring
test_json.test_separators test_json.test_separators
test_json.test_speedups test_json.test_speedups
test_json.test_tool test_json.test_tool subprocess
test_json.test_unicode test_json.test_unicode
test_keyword test_keyword subprocess
test_keywordonlyarg test_keywordonlyarg
test_kqueue test_kqueue
test_largefile test_largefile
test_lib2to3 test_lib2to3 crash
test_linecache test_linecache
test_list test_list
test_listcomps test_listcomps
test_locale test_locale locale
test_logging test_logging networking
test_long test_long
test_longexp test_longexp
test_lzma test_lzma
test_macpath test_macpath platform-specific
test_macurl2path test_macurl2path
test_mailbox test_mailbox crash
test_mailcap test_mailcap unknown
test_marshal test_marshal
test_math test_math
test_memoryio test_memoryio
...@@ -280,9 +310,9 @@ test_mimetypes ...@@ -280,9 +310,9 @@ test_mimetypes
test_minidom test_minidom
test_mmap test_mmap
test_module test_module
test_modulefinder test_modulefinder crash
test_msilib test_msilib
test_multibytecodec test_multibytecodec unknown codec
test_multiprocessing_fork test_multiprocessing_fork
test_multiprocessing_forkserver test_multiprocessing_forkserver
test_multiprocessing_main_handling test_multiprocessing_main_handling
...@@ -291,33 +321,33 @@ test_netrc ...@@ -291,33 +321,33 @@ test_netrc
test_nis test_nis
test_nntplib test_nntplib
test_normalization test_normalization
test_ntpath test_ntpath platform
test_numeric_tower test_numeric_tower
test_opcodes test_opcodes
test_openpty test_openpty platform-specific
test_operator test_operator
test_optparse test_optparse floating point
test_ordered_dict test_ordered_dict
test_os test_os mmap
test_ossaudiodev test_ossaudiodev
test_osx_env test_osx_env
test_parser test_parser
test_pathlib test_pathlib crash
test_pdb test_pdb subprocess
test_peepholer test_peepholer
test_pickle test_pickle dbm
test_pickletools test_pickletools dbm
test_pipes test_pipes platform-specific
test_pkg test_pkg
test_pkgimport test_pkgimport crash
test_pkgutil test_pkgutil crash
test_platform test_platform subprocess
test_plistlib test_plistlib
test_poll test_poll subprocess
test_popen test_popen subprocess
test_poplib test_poplib
test_posix test_posix crash
test_posixpath test_posixpath crash
test_pow test_pow
test_pprint test_pprint
test_print test_print
...@@ -326,82 +356,82 @@ test_property ...@@ -326,82 +356,82 @@ test_property
test_pstats test_pstats
test_pty test_pty
test_pulldom test_pulldom
test_pwd test_pwd crash
test_py_compile test_py_compile crash
test_pyclbr test_pyclbr
test_pydoc test_pydoc crash
test_pyexpat test_pyexpat
test_queue test_queue
test_quopri test_quopri subprocess
test_raise test_raise
test_random test_random
test_range test_range
test_re test_re unknown codec
test_readline test_readline
test_regrtest test_regrtest subprocess
test_repl test_repl subprocess
test_reprlib test_reprlib
test_resource test_resource
test_richcmp test_richcmp
test_rlcompleter test_rlcompleter
test_robotparser test_robotparser
test_runpy test_runpy crash
test_sax test_sax
test_sched test_sched
test_scope test_scope
test_script_helper test_script_helper
test_secrets test_secrets
test_select test_select networking
test_selectors test_selectors networking
test_set test_set
test_setcomps test_setcomps
test_shelve test_shelve
test_shlex test_shlex
test_shutil test_shutil crash
test_signal test_signal
test_site test_site subprocess
test_slice test_slice
test_smtpd test_smtpd
test_smtplib test_smtplib
test_smtpnet test_smtpnet
test_sndhdr test_sndhdr audioop
test_socket test_socket
test_socketserver test_socketserver
test_sort test_sort
test_source_encoding test_source_encoding subprocess, unknown encoding
test_spwd test_spwd
test_sqlite test_sqlite
test_ssl test_ssl
test_startfile test_startfile
test_stat test_stat
test_statistics test_statistics floating point
test_strftime test_strftime strftime
test_string test_string
test_string_literals test_string_literals crash
test_stringprep test_stringprep
test_strptime test_strptime strftime
test_strtod test_strtod
test_struct test_struct
test_structmembers test_structmembers
test_structseq test_structseq
test_subclassinit test_subclassinit
test_subprocess test_subprocess
test_sunau test_sunau audioop
test_sundry test_sundry nonsense
test_super test_super
test_support test_support crash
test_symbol test_symbol
test_symtable test_symtable
test_syntax test_syntax
test_sys test_sys subprocess
test_sys_setprofile test_sys_setprofile
test_sys_settrace test_sys_settrace
test_sysconfig test_sysconfig nonsense
test_syslog test_syslog
test_tarfile test_tarfile crash
test_tcl test_tcl
test_telnetlib test_telnetlib
test_tempfile test_tempfile crash
test_textwrap test_textwrap
test_thread test_thread
test_threaded_import test_threaded_import
...@@ -425,28 +455,28 @@ test_tools.test_reindent ...@@ -425,28 +455,28 @@ test_tools.test_reindent
test_tools.test_sundry test_tools.test_sundry
test_tools.test_unparse test_tools.test_unparse
test_trace test_trace
test_traceback test_traceback subprocess
test_tracemalloc test_tracemalloc
test_ttk_guionly test_ttk_guionly
test_ttk_textonly test_ttk_textonly
test_tuple test_tuple
test_turtle test_turtle
test_typechecks test_typechecks
test_types test_types floating point
test_typing test_typing unknown
test_ucn test_ucn
test_unary test_unary
test_unicode test_unicode crash
test_unicode_file test_unicode_file unknown codec
test_unicode_file_functions test_unicode_file_functions
test_unicode_identifiers test_unicode_identifiers
test_unicodedata test_unicodedata
test_unittest test_unittest os.kill
test_univnewlines test_univnewlines
test_unpack test_unpack
test_unpack_ex test_unpack_ex
test_urllib test_urllib crash
test_urllib2 test_urllib2 subprocess
test_urllib2_localnet test_urllib2_localnet
test_urllib2net test_urllib2net
test_urllib_response test_urllib_response
...@@ -457,14 +487,14 @@ test_userlist ...@@ -457,14 +487,14 @@ test_userlist
test_userstring test_userstring
test_utf8source test_utf8source
test_uu test_uu
test_uuid test_uuid subprocess
test_venv test_venv crash
test_wait3 test_wait3
test_wait4 test_wait4
test_wave test_wave crash
test_weakref test_weakref
test_weakset test_weakset
test_webbrowser test_webbrowser replaced
test_winconsoleio test_winconsoleio
test_winreg test_winreg
test_winsound test_winsound
...@@ -472,14 +502,14 @@ test_with ...@@ -472,14 +502,14 @@ test_with
test_wsgiref test_wsgiref
test_xdrlib test_xdrlib
test_xml_dom_minicompat test_xml_dom_minicompat
test_xml_etree test_xml_etree unknown encoding
test_xml_etree_c test_xml_etree_c unknown encoding
test_xmlrpc test_xmlrpc networking
test_xmlrpc_net test_xmlrpc_net
test_yield_from test_yield_from
test_zipapp test_zipapp crash
test_zipfile test_zipfile crash
test_zipfile64 test_zipfile64
test_zipimport test_zipimport crash
test_zipimport_support test_zipimport_support crash
test_zlib test_zlib
...@@ -20,17 +20,21 @@ def test_print(selenium): ...@@ -20,17 +20,21 @@ def test_print(selenium):
assert 'This should be logged' in selenium.logs assert 'This should be logged' in selenium.logs
@pytest.mark.skipif(True, reason="Experimental")
def test_run_core_python_test(python_test, selenium): def test_run_core_python_test(python_test, selenium):
selenium.run( selenium.run(
"import sys\n" "import sys\n"
"sys.argv = ['pyodide']\n"
"exitcode = -1\n" "exitcode = -1\n"
"def exit(n):\n" "def exit(n=0):\n"
" global exitcode\n" " global exitcode\n"
" exitcode = n\n" " exitcode = n\n"
" raise SystemExit()\n\n" " raise SystemExit()\n\n"
"sys.exit = exit\n") "sys.exit = exit\n")
# Undo the lazy modules setup -- it interferes with the CPython test
# harness
selenium.run(
"for k in list(sys.modules):\n"
" if k.startswith('numpy'):\n"
" del sys.modules[k]\n")
selenium.run( selenium.run(
"from test.libregrtest import main\n" "from test.libregrtest import main\n"
"main(['{}'], verbose=True, verbose3=True)".format(python_test)) "main(['{}'], verbose=True, verbose3=True)".format(python_test))
...@@ -40,14 +44,16 @@ def test_run_core_python_test(python_test, selenium): ...@@ -40,14 +44,16 @@ def test_run_core_python_test(python_test, selenium):
assert exitcode == 0 assert exitcode == 0
@pytest.mark.skipif(True, reason="Experimental")
def pytest_generate_tests(metafunc): def pytest_generate_tests(metafunc):
if 'python_test' in metafunc.fixturenames: if 'python_test' in metafunc.fixturenames:
test_modules = [] test_modules = []
with open( with open(
pathlib.Path(__file__).parents[0] / "python_tests.txt") as fp: pathlib.Path(__file__).parents[0] / "python_tests.txt") as fp:
for line in fp: for line in fp:
parts = line.strip().split() line = line.strip()
if line.startswith('#'):
continue
parts = line.split()
if len(parts) == 1: if len(parts) == 1:
test_modules.append(parts[0]) test_modules.append(parts[0])
metafunc.parametrize("python_test", test_modules) metafunc.parametrize("python_test", test_modules)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment