diff options
author | Armin Rigo <arigo@tunes.org> | 2020-11-26 18:54:47 +0100 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2020-11-26 18:54:47 +0100 |
commit | db295387f2ef7058cb3ce95571d6c1151f6be80a (patch) | |
tree | 073923c7970f1c093b75f2fb4bbccabd9d26e8a4 /extra_tests | |
parent | Merge branch 'branch/rpy-cparser' into 'branch/default' (diff) | |
download | pypy-db295387f2ef7058cb3ce95571d6c1151f6be80a.tar.gz pypy-db295387f2ef7058cb3ce95571d6c1151f6be80a.tar.bz2 pypy-db295387f2ef7058cb3ce95571d6c1151f6be80a.zip |
Workaround for CPython's tests. See comment
Diffstat (limited to 'extra_tests')
-rw-r--r-- | extra_tests/test_pypy_modules.py | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/extra_tests/test_pypy_modules.py b/extra_tests/test_pypy_modules.py new file mode 100644 index 0000000000..de105158fc --- /dev/null +++ b/extra_tests/test_pypy_modules.py @@ -0,0 +1,83 @@ +import sys +import importlib +import pytest + +# This is a workaround for a dubious feature of CPython's test suite: it skips +# tests silently if importing a module fails. This makes some partial sense +# for CPython itself when testing C extension modules directly, because very +# often (but not always) a C extension module is either completely absent or +# imports successfully. But for PyPy it's a mess because it can hide mistakes +# very easily, and it did. So the list we build here should contain the names +# of every module that CPython's tests import with test.support.import_module() +# but that should really be present on the running platform. + + +expected_modules = [] + +# ----- everywhere ----- +expected_modules += [ + 'MimeWriter', + 'bz2', + 'commands', + 'compiler', + '_ctypes', + 'dircache', + 'fpformat', + 'gzip', + 'htmllib', + 'mhlib', + 'mimetools', + 'mmap', + 'multifile', + '_multiprocessing', + 'multiprocessing.synchronize', + 'mutex', + 'new', + 'sre', + 'rfc822', + 'sets', + '_sqlite3', + 'ssl', + 'thread', + 'threading', + 'xmllib', + 'zlib', +] + +# ----- non-Windows ----- +if sys.platform != 'win32': + expected_modules += [ + 'curses', + 'curses.ascii', + 'curses.textpad', + 'dbm', + 'fcntl', + 'gdbm', + 'grp', + 'posix', + 'pwd', + 'readline', + 'resource', + 'termios', + ] +else: + # ----- Windows only ----- + expected_modules += [ + '_winreg', + ] + +# ----- Linux only ----- +if sys.platform.startswith('linux'): + expected_modules += [ + 'crypt', + ] + + +# ------------------------------------------------ + +@pytest.fixture(scope="module", params=expected_modules) +def modname(request): + return request.param + +def test_expected_modules(modname): + importlib.import_module(modname) |