mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-40280: Skip socket, fork, subprocess tests on Emscripten (GH-31986)
- Add requires_fork and requires_subprocess to more tests - Skip extension import tests if dlopen is not available - Don't assume that _testcapi is a shared extension - Skip a lot of socket tests that don't work on Emscripten - Skip mmap tests, mmap emulation is incomplete - venv does not work yet - Cannot get libc from executable The "entire" test suite is now passing on Emscripten with EMSDK from git head (91 suites are skipped).
This commit is contained in:
parent
a25a985535
commit
deeaac49e2
52 changed files with 238 additions and 23 deletions
|
@ -20,7 +20,7 @@ from unittest import mock
|
|||
|
||||
from test.support import os_helper
|
||||
from test.support import (
|
||||
STDLIB_DIR, is_jython, swap_attr, swap_item, cpython_only)
|
||||
STDLIB_DIR, is_jython, swap_attr, swap_item, cpython_only, is_emscripten)
|
||||
from test.support.import_helper import (
|
||||
forget, make_legacy_pyc, unlink, unload, DirsOnSysPath, CleanImport)
|
||||
from test.support.os_helper import (
|
||||
|
@ -101,8 +101,17 @@ class ImportTests(unittest.TestCase):
|
|||
with self.assertRaises(ImportError) as cm:
|
||||
from _testcapi import i_dont_exist
|
||||
self.assertEqual(cm.exception.name, '_testcapi')
|
||||
self.assertEqual(cm.exception.path, _testcapi.__file__)
|
||||
self.assertRegex(str(cm.exception), r"cannot import name 'i_dont_exist' from '_testcapi' \(.*\.(so|pyd)\)")
|
||||
if hasattr(_testcapi, "__file__"):
|
||||
self.assertEqual(cm.exception.path, _testcapi.__file__)
|
||||
self.assertRegex(
|
||||
str(cm.exception),
|
||||
r"cannot import name 'i_dont_exist' from '_testcapi' \(.*\.(so|pyd)\)"
|
||||
)
|
||||
else:
|
||||
self.assertEqual(
|
||||
str(cm.exception),
|
||||
"cannot import name 'i_dont_exist' from '_testcapi' (unknown location)"
|
||||
)
|
||||
|
||||
def test_from_import_missing_attr_has_name(self):
|
||||
with self.assertRaises(ImportError) as cm:
|
||||
|
@ -525,6 +534,7 @@ class FilePermissionTests(unittest.TestCase):
|
|||
|
||||
@unittest.skipUnless(os.name == 'posix',
|
||||
"test meaningful only on posix systems")
|
||||
@unittest.skipIf(is_emscripten, "Emscripten's umask is a stub.")
|
||||
def test_creation_mode(self):
|
||||
mask = 0o022
|
||||
with temp_umask(mask), _ready_to_import() as (name, path):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue