Skip to content

Too many slow tests in 'fast' (default) test suite run #31419

Closed

Description

@rgommers

This problem is magnified on gh-30995 because the RISC-V cores aren't all that performant (~10x slower than my M1 Macbook), however there are a lot of tests that are failing our design rule - which isn't super crisply written down I believe - of tests having to be marked as slow if they exceed 0.5 sec (maybe we've used 1 sec. in the past, but not more than that), unless there's a good reason not to.

Here are the 40 slowest tests I observe right now on a default spin test on an M1 Macbook:

====================================================================== slowest 40 durations =======================================================================
4.23s setup    build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_cython.py::test_is_timedelta64_object
4.02s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_array_from_pyobj.py::TestIntent::test_in_out
3.44s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_parameter.py::TestParameters::test_constant_array
3.42s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_data.py::TestDataWithCommentsF77::test_data_stmts
3.40s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_isoc.py::TestISOC::test_bindc_function
3.38s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_data.py::TestDataF77::test_data_stmts
3.38s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_character.py::TestMiscCharacter::test_gh6308
3.36s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_data.py::TestData::test_crackedlines
3.34s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_crackfortran.py::TestDimSpec::test_inv_array_size[n]
3.34s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_string.py::TestDocStringArguments::test_example
3.33s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_callback.py::TestF77CallbackPythonTLS::test_docstring
3.30s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_callback.py::TestGH25211::test_gh25211
3.30s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_kind.py::TestKind::test_int
3.29s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_f2cmap.py::TestF2Cmap::test_gh15095
3.28s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_crackfortran.py::TestCrackFortran::test_gh2848
3.28s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_callback.py::TestF77Callback::test_docstring
3.25s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_character.py::TestStringScalarArr::test_char
3.24s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_mixed.py::TestMixed::test_docstring
3.24s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_data.py::TestDataMultiplierF77::test_data_stmts
3.23s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_character.py::TestCharacter::test_input[c]
3.22s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_string.py::TestFixedString::test_intent_in
3.21s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_character.py::TestStringAssumedLength::test_gh24008
3.21s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_crackfortran.py::TestNoSpace::test_module
3.17s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_crackfortran.py::TestExternal::test_external_as_statement
3.17s setup    build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_common.py::TestCommonWithUse::test_common_gh19161
3.14s call     build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_f2py2e.py::test_latex_doc_gh30268
2.90s setup    build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_limited_api.py::test_limited_api
2.77s call     build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_f2py2e.py::test_no_distutils_backend
2.76s call     build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_f2py2e.py::test_untitled_cli
2.42s call     build-install/usr/lib/python3.14/site-packages/numpy/testing/tests/test_utils.py::TestAssertNoGcCycles::test_asserts
2.38s call     build-install/usr/lib/python3.14/site-packages/numpy/tests/test_ctypeslib.py::TestAsArray::test_reference_cycles
2.33s call     build-install/usr/lib/python3.14/site-packages/numpy/testing/tests/test_utils.py::TestAssertNoGcCycles::test_passes
2.16s call     build-install/usr/lib/python3.14/site-packages/numpy/lib/tests/test_function_base.py::TestLeaks::test_frompyfunc_leaks[bound-20]
2.13s call     build-install/usr/lib/python3.14/site-packages/numpy/linalg/tests/test_regression.py::TestRegression::test_openblas_threading
2.10s call     build-install/usr/lib/python3.14/site-packages/numpy/lib/tests/test_io.py::test_load_refcount
2.00s setup    build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_mem_policy.py::test_set_policy
1.94s call     build-install/usr/lib/python3.14/site-packages/numpy/lib/tests/test_function_base.py::TestLeaks::test_frompyfunc_leaks[unbound-0]
1.78s call     build-install/usr/lib/python3.14/site-packages/numpy/lib/tests/test_function_base.py::TestPercentile::test_percentile_gh_29003_Fraction
1.24s call     build-install/usr/lib/python3.14/site-packages/numpy/tests/test_public_api.py::test_all_modules_are_expected_2
0.87s call     build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_multiarray.py::TestPickling::test_roundtrip

Almost all of these are compile tests or special-purpose tests like GC checks or pickling roundtrips. There is no good reason for most of these to not be marked as slow.

I'll open a PR.

Activity

  1. rgommers commented on May 13, 2026

    @rgommers
    MemberAuthor

    One constraint is that we need some test coverage for cython and f2py in the default test suite, so it needs a couple of compile tests. Same for pickling and multi-threaded tests. That can be sparse coverage though; we have a lot of 'full' test coverage in CI (1-2 jobs per platform), and CI exists for a reason.

    Keeping that constraint in mind and then applying slow markers relatively liberally, we can get to a result like this (timing on M5 Macbook, all tests about 0.15 sec.):

    3.15s setup    build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_cython.py::test_is_timedelta64_object
    2.50s setup    build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_limited_api.py::test_limited_api
    1.42s setup    build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_mem_policy.py::test_default_policy_singleton
    0.76s call     build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_limited_api.py::test_limited_api
    0.55s call     build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_multiarray.py::TestPickling::test_roundtrip
    0.46s call     build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_multiarray.py::TestArrayFinalize::test_lifetime_on_error
    0.38s call     build-install/usr/lib/python3.14/site-packages/numpy/random/tests/test_regression.py::TestRegression::test_shuffle_of_array_of_objects
    0.37s call     build-install/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_crackfortran.py::TestNameArgsPatternBacktracking::test_nameargspattern_backtracking[@)@bind                         @(@]
    0.36s call     build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_ufunc.py::TestUfunc::test_identityless_reduction_huge_array
    0.33s call     build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_arrayprint.py::test_multithreaded_array_printing
    0.32s call     build-install/usr/lib/python3.14/site-packages/numpy/random/tests/test_generator_mt19937_regressions.py::TestRegression::test_shuffle_of_array_of_objects
    0.30s call     build-install/usr/lib/python3.14/site-packages/numpy/random/tests/test_regression.py::TestRegression::test_shuffle_of_array_of_different_length_strings
    0.28s call     build-install/usr/lib/python3.14/site-packages/numpy/random/tests/test_generator_mt19937_regressions.py::TestRegression::test_shuffle_of_array_of_different_length_strings
    0.26s call     build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_mem_policy.py::test_owner_is_base
    0.25s call     build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_cython.py::test_is_timedelta64_object
    0.23s call     build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_mem_overlap.py::test_internal_overlap_fuzz
    0.20s call     build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_regression.py::TestRegression::test_leak_in_structured_dtype_comparison
    0.19s call     build-install/usr/lib/python3.14/site-packages/numpy/random/tests/test_randomstate.py::test_integer_repeat[multinomial]
    0.19s call     build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_multiarray.py::TestUnicodeEncoding::test_round_trip
    0.19s call     build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_multiarray.py::TestAlignment::test_various_alignments
    0.18s call     build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_arrayprint.py::TestArray2String::test_any_text
    0.18s call     build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_numeric.py::TestClip::test_clip_property
    0.18s call     build-install/usr/lib/python3.14/site-packages/numpy/_core/tests/test_multiarray.py::TestMethods::test_sort_degraded
    

    Total test time for spin test is then ~45 sec. on M5, so should be about 1.5 minute on M1 and 2-3 minutes on x86-64.

  2. mattip commented on May 13, 2026

    @mattip
    Member

    +1 for making the fast tests fast.

  3. added this to the 2.5.0 Release milestone on May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions