Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyodide
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
pyodide
Commits
2690ece8
Commit
2690ece8
authored
Apr 11, 2018
by
Michael Droettboom
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'cpython-tests'
parents
1cc1ba48
8b1c538e
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
254 additions
and
130 deletions
+254
-130
Makefile
Makefile
+1
-1
cpython/Setup.local
cpython/Setup.local
+4
-0
cpython/patches/testing.patch
cpython/patches/testing.patch
+84
-0
src/sitecustomize.py
src/sitecustomize.py
+4
-4
test/python_tests.txt
test/python_tests.txt
+150
-120
test/test_python.py
test/test_python.py
+11
-5
No files found.
Makefile
View file @
2690ece8
...
...
@@ -60,7 +60,7 @@ build/test.html: src/test.html
test
:
all build/test.html
py.test
test
-v
-x
py.test
test
-v
benchmark
:
all build/test.html
...
...
cpython/Setup.local
View file @
2690ece8
...
...
@@ -15,6 +15,8 @@ _heapq _heapqmodule.c
_json _json.c
_csv _csv.c
unicodedata unicodedata.c
_pickle _pickle.c
parser parsermodule.c
_socket socketmodule.c
select selectmodule.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
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
_sha256 sha256module.c
_sha512 sha512module.c
...
...
cpython/patches/testing.patch
View file @
2690ece8
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
src/sitecustomize.py
View file @
2690ece8
...
...
@@ -2,11 +2,11 @@ import lazy_import
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.polynomial")
#
lazy_import.lazy_module("numpy.random")
#
lazy_import.lazy_module("numpy.ctypeslib")
lazy_import
.
lazy_module
(
"numpy.polynomial"
)
lazy_import
.
lazy_module
(
"numpy.random"
)
lazy_import
.
lazy_module
(
"numpy.ctypeslib"
)
import
sys
sys
.
argv
=
[
'pyodide'
]
test/python_tests.txt
View file @
2690ece8
This diff is collapsed.
Click to expand it.
test/test_python.py
View file @
2690ece8
...
...
@@ -20,17 +20,21 @@ def test_print(selenium):
assert
'This should be logged'
in
selenium
.
logs
@
pytest
.
mark
.
skipif
(
True
,
reason
=
"Experimental"
)
def
test_run_core_python_test
(
python_test
,
selenium
):
selenium
.
run
(
"import sys
\
n
"
"sys.argv = ['pyodide']
\
n
"
"exitcode = -1
\
n
"
"def exit(n):
\
n
"
"def exit(n
=0
):
\
n
"
" global exitcode
\
n
"
" exitcode = n
\
n
"
" raise SystemExit()
\
n
\
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
(
"from test.libregrtest import main
\
n
"
"main(['{}'], verbose=True, verbose3=True)"
.
format
(
python_test
))
...
...
@@ -40,14 +44,16 @@ def test_run_core_python_test(python_test, selenium):
assert
exitcode
==
0
@
pytest
.
mark
.
skipif
(
True
,
reason
=
"Experimental"
)
def
pytest_generate_tests
(
metafunc
):
if
'python_test'
in
metafunc
.
fixturenames
:
test_modules
=
[]
with
open
(
pathlib
.
Path
(
__file__
).
parents
[
0
]
/
"python_tests.txt"
)
as
fp
:
for
line
in
fp
:
parts
=
line
.
strip
().
split
()
line
=
line
.
strip
()
if
line
.
startswith
(
'#'
):
continue
parts
=
line
.
split
()
if
len
(
parts
)
==
1
:
test_modules
.
append
(
parts
[
0
])
metafunc
.
parametrize
(
"python_test"
,
test_modules
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment