Skip to content

gh-161430: Omit tests expected to be skipped in regrtest - #161432

Open
vstinner wants to merge 26 commits into
python:mainfrom
vstinner:regrtest_expected_skip
Open

vstinner wants to merge 26 commits into
python:mainfrom
vstinner:regrtest_expected_skip

Conversation

@vstinner

@vstinner vstinner commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

@vstinner

vstinner commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

Current status.

Windows:

3 tests skipped:
    test_perf_profiler test_perfmaps test_samply_profiler

macOS:

6 tests skipped:
    test.test_gdb.test_backtrace test.test_gdb.test_cfunction
    test.test_gdb.test_cfunction_full test.test_gdb.test_jit
    test.test_gdb.test_misc test.test_gdb.test_pretty_print

Ubuntu:

1 test skipped:
    test_interpreters

@vstinner

vstinner commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

Emscripten:

200 tests expected to be skipped (not listed)

9 tests skipped:
    test.test_gdb.test_backtrace test.test_gdb.test_cfunction
    test.test_gdb.test_cfunction_full test.test_gdb.test_jit
    test.test_gdb.test_misc test.test_gdb.test_pretty_print
    test__interpreters test_perfmaps test_pty

@vstinner

vstinner commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

iOS:

  123 tests expected to be skipped (not listed)
  
  10 tests skipped:
      test.test_asyncio.test_subprocess test.test_gdb.test_backtrace
      test.test_gdb.test_cfunction test.test_gdb.test_cfunction_full
      test.test_gdb.test_jit test.test_gdb.test_misc
      test.test_gdb.test_pretty_print test_asdl_parser test_perfmaps
      test_pty

@vstinner

vstinner commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

Update.

Windows / Build and test (x64, switch-case) and Windows (free-threading) / Build and test (x64, switch-case):

52 tests expected to be skipped (not listed)

1 test skipped:
    test_xxlimited

macOS: 85 tests expected to be skipped (not listed)

macOS (free-threading) / build and test (macos-26): 25 tests expected to be skipped (not listed)

Ubuntu / build and test (ubuntu-26.04): 76 tests expected to be skipped (not listed)

Android (x86_64): 130 tests expected to be skipped (not listed)

iOS: 132 tests expected to be skipped (not listed)

Emscripten: 209 tests expected to be skipped (not listed)

WASI:232 tests expected to be skipped (not listed)

TSan: 63 tests expected to be skipped (not listed)

ASan:

75 tests expected to be skipped (not listed)

27 tests skipped:
    test.test_asyncio.test_subprocess
    test.test_concurrent_futures.test_as_completed
    test.test_concurrent_futures.test_deadlock
    test.test_concurrent_futures.test_future
    test.test_concurrent_futures.test_init
    test.test_concurrent_futures.test_interpreter_pool
    test.test_concurrent_futures.test_process_pool
    test.test_concurrent_futures.test_shutdown
    test.test_concurrent_futures.test_thread_pool
    test.test_concurrent_futures.test_wait
    test.test_multiprocessing_fork.test_manager
    test.test_multiprocessing_fork.test_misc
    test.test_multiprocessing_fork.test_processes
    test.test_multiprocessing_fork.test_threads
    test.test_multiprocessing_forkserver.test_manager
    test.test_multiprocessing_forkserver.test_misc
    test.test_multiprocessing_forkserver.test_processes
    test.test_multiprocessing_forkserver.test_threads
    test.test_multiprocessing_spawn.test_manager
    test.test_multiprocessing_spawn.test_misc
    test.test_multiprocessing_spawn.test_processes
    test.test_multiprocessing_spawn.test_threads test_idle
    test_perf_profiler test_samply_profiler test_tkinter test_ttk

UBSan: 75 tests expected to be skipped (not listed)

MSan:

88 tests expected to be skipped (not listed)

18 tests skipped:
    test.test_concurrent_futures.test_as_completed
    test.test_concurrent_futures.test_deadlock
    test.test_concurrent_futures.test_future
    test.test_concurrent_futures.test_init
    test.test_concurrent_futures.test_interpreter_pool
    test.test_concurrent_futures.test_process_pool
    test.test_concurrent_futures.test_shutdown
    test.test_concurrent_futures.test_thread_pool
    test.test_concurrent_futures.test_wait test_bz2 test_ctypes
    test_dbm_sqlite3 test_gzip test_perf_profiler test_samply_profiler
    test_sqlite3 test_stable_abi_ctypes test_zlib

I didn't note tests skipped because of denied resources, such as 3 tests skipped (resource denied): test_peg_generator test_xpickle test_zipfile64 on Ubuntu.

@vstinner
vstinner marked this pull request as ready for review November 5, 2026 22:04
@vstinner

vstinner commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

@cmaloney: Ok, the PR is now ready for review :-)

Lib/test/libregrtest/skipped.py implements multiple different rulesets / heuristics to check if a test is expected to be skipped or not. The rulset is now complete so that there is no more "skipped" tests, only "tests expected to be skipped (not listed)".

The question is now which rulesets/heuristics are a good thing and which ones are a bad thing :-)

I think that the following rules are safe:

  • support.MS_WINDOWS
  • support.Py_GIL_DISABLED
  • sys.platform
  • IS_WASI: set from _PYTHON_HOST_PLATFORM environment variable, needed to filter properly tests on WASI

Safe rules which test sys.platform in practice:

  • support.is_android
  • support.is_apple
  • support.is_emscripten
  • support.has_socket_support
  • support.has_subprocess_support
  • support.is_wasm32
  • NEED_WORKING_THREADING: IS_WASI and threading_helper.can_start_thread check sys.platform

It should be ok:

  • support.has_fork_support: check sys.platform, but check also hasattr(os, "fork"). It should be ok to test hasattr(os, "fork").
  • sysconfig.get_config_var('WITH_DTRACE') (./configure --with-dtrace) check for test_dtrace
  • sysconfig.is_python_build() check for test_asdl_parser: skip if Python is installed. The test says: "test irrelevant for an installed Python".
  • support.supports_perf_trampoline_profiling() for test_perf_profiler, test_perfmaps and test_samply_profiler: check PY_HAVE_PERF_TRAMPOLINE macro which is only set on selected platforms+architectures by configure. So in practice, it checks the platform + architecture.

In the grey area, I'm not sure:

  • Test directly hasattr(os, function_name): maybe it should be replaced with a test on sys.platform. Tested functions: startfile() (Windows only), openpty(), wait3() and wait4() (not available on Windows).
  • sys.is_remote_debug_enabled(): maybe it should be replaced with a test on sys.platform + platform.architecture(). We mostly care about Py_SUPPORTS_REMOTE_DEBUG macro. If ./configure --without-remote-debug is used, the tests should be reported as skipped. Same if PYTHON_DISABLE_REMOTE_DEBUG env var or -X disable-remote-debug command line option is used.
  • shutil.which('gdb') for test_gdb: Should we complain that gdb is not installed, so complain if test_gdb tests are skipped?
  • SELECT_TESTS: is it ok to check hasattr(select, name)? devpoll() is available on Solaris, kqueue on FreeBSD and macOS, epoll() on Linux, select() on non-Windows platforms. But having exhaustive list of supported and unsupported platforms is more tricky to write.

Bad idea?

  • NEED_MODULES is most risky check. If Python fails to build an extension module (ex: ctypes), NEED_MODULES ignores silently that the test is skipped because of the build error. Maybe it should be replaced with a test on sys.platform. For example, fcntl cannot be built on Windows, so it's safe to expect test_fcntl to be skipped on Windows.

* Replace hasattr(os, name) check for sys.platform check.
* List disabled extensions on Apple mobile and on Emscripten
@vstinner
vstinner marked this pull request as draft November 5, 2026 23:08
@vstinner

vstinner commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

Sorry, I changed my mind and marked again the PR as a draft. I'm making more changes to address #161432 (comment).

@vstinner

vstinner commented Nov 6, 2026 •

Copy link
Copy Markdown
Member Author

UPDATE: I updated this comment for my latest commits.

(Yet another) Update.

No tests is skipped on:

  • Ubuntu -- same on ARM64 and Free Threading
  • Emscripten
  • WASI
  • iOS
  • Lazy imports enabled / Run Tests with lazy_imports=all
  • TSan
  • UBSan
  • Cross build Linux (well, it only runs 3 tests!)

Skip test_gdb, 6 tests skipped: test.test_gdb(...) (all gdb tests):

  • macOS: same on ARM64/x86-64 and Free Threading
  • Ubuntu (bolt)
  • Ubuntu (installed)
  • Hypothesis tests on Ubuntu

=> Should we install gdb on these CIs? macOS uses clang and might prefer lldb but we don't provide any helper/script for lldb.

CIs skipping tests:

  • Windows / Build and test (x64, tail-call): 2 tests skipped: test_curses test_xxtestfuzz -- same on Free Threading
  • Windows / Build and test (x64, switch-case): 3 tests skipped: test_curses test_xxlimited test_xxtestfuzz -- same on Free Threading. Why is test_xxlimited only skipped on switch-case build?
  • Android (x86_64): 1 test skipped: test_curses

ASan:

12 tests skipped:
    test.test_asyncio.test_subprocess
    test.test_concurrent_futures.test_as_completed
    test.test_concurrent_futures.test_deadlock
    test.test_concurrent_futures.test_future
    test.test_concurrent_futures.test_init
    test.test_concurrent_futures.test_interpreter_pool
    test.test_concurrent_futures.test_process_pool
    test.test_concurrent_futures.test_shutdown
    test.test_concurrent_futures.test_thread_pool
    test.test_concurrent_futures.test_wait
    test_perf_profiler test_samply_profiler

MSan:

25 tests skipped:
    test.test_concurrent_futures.test_as_completed
    test.test_concurrent_futures.test_deadlock
    test.test_concurrent_futures.test_future
    test.test_concurrent_futures.test_init
    test.test_concurrent_futures.test_interpreter_pool
    test.test_concurrent_futures.test_process_pool
    test.test_concurrent_futures.test_shutdown
    test.test_concurrent_futures.test_thread_pool
    test.test_concurrent_futures.test_wait test_bz2 test_ctypes
    test_dbm_gnu test_dbm_ndbm test_dbm_sqlite3 test_gzip test_lzma
    test_perf_profiler test_readline test_samply_profiler test_smtpnet
    test_sqlite3 test_ssl test_stable_abi_ctypes test_zlib test_zstd

Note: I didn't check "tests skipped (resource denied)": this list is not changed by the PR.

@vstinner
vstinner marked this pull request as ready for review November 6, 2026 21:18
@vstinner

vstinner commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

Ok, new milestone! I modified libregrtest/skipped.py to almost only check sys.platform. I mark the PR ready for review again.

I filtered tests which have dependencies disabled by configure. Example of Apple mobile from configure.ac:

  [iOS|tvOS|visionOS|watchOS], [
    dnl subprocess and multiprocessing are not supported (no fork syscall).
    dnl curses and tkinter user interface are not available.
    dnl gdbm and nis aren't available
    dnl Stub implementations are provided for pwd, grp etc APIs
    PY_STDLIB_MOD_SET_NA(
      [_curses],
      [_curses_panel],
      [_gdbm],
      [_multiprocessing],
      [_posixshmem],
      [_posixsubprocess],
      [_scproxy],
      [_tkinter],
      [grp],
      [nis],
      [readline],
      [pwd],
      [spwd],
      [syslog],
    )
  ],

To make the test report more readable, I also ignored tests with dependencies which are expected to be missing on Emscripten, WASI and Android.

Android:

    # Missing dependencies on Android
    EXPECTED_SKIP |= {
        'test_curses',                 # need _curses
        'test_dbm_gnu',                # need _gdbm
        'test_dbm_ndbm',               # need _dbm
        'test_grp',                    # need grp
        'test_readline',               # need libreadline/libedit
    }

Emscripten:

    # Missing dependencies on Emscripten
    EXPECTED_SKIP |= {
        'test_lzma',                   # need _lzma
        'test_zstd',                   # need _zstd
    }
    # Missing OpenSSL dependency on Emscripten
    EXPECTED_SKIP |= NEED_SSL
    # Missing Tcl/Tk dependency on Emscripten
    EXPECTED_SKIP |= NEED_TKINTER

WASI:

    # Missing dependencies on WASI
    EXPECTED_SKIP |= {
        'test_bz2',                    # need _bz2
        'test_ctypes',                 # need _ctypes
        'test_dbm_sqlite3',            # need _sqlite3
        'test_gzip',                   # need zlib
        'test_lzma',                   # need _lzma
        'test_readline',               # need libreadline/libedit
        'test_sqlite3',                # need _sqlite3
        'test_stable_abi_ctypes',      # need _ctypes
        'test_zlib',                   # need zlib
        'test_zstd',                   # need _zstd
    }
    # Missing OpenSSL dependency on WASI
    EXPECTED_SKIP |= NEED_SSL
    # Missing Tcl/Tk dependency on WASI
    EXPECTED_SKIP |= NEED_TKINTER

@mhsmith @hoodmane @brettcannon: Hi! Are you ok marking these tests as "expected to be skipped" on Android, Emscripten and WASI? Do you see reasons why one of these dependencies may become available in the future? Are you ok to keep these filters for now, and maybe update libregrtest/skipped.py file in the future if a dependency becomes available?

In the worst case, a skipped test is hidden in the final test report, instead of being listed. But the test is still present in full logs obviously, with the reason for the skip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant