Skip to content

flaky unit test: test_n_slowest_value - regex may not match slowest-read docname #14109

@jayaddison

Description

@jayaddison

Describe the bug

The test_n_slowest_value test failed as a one-off while we were attempting to fix another flaky test in pull request #14107: https://github.com/sphinx-doc/sphinx/actions/runs/19748819758/job/56588233131?pr=14107#step:10:5014

        matches = re.findall(r'\d+\.\d{3}s\s+[A-Za-z0-9]+\n', app.status.getvalue())
>       assert len(matches) == 2
E       AssertionError: assert 1 == 2
E        +  where 1 = len(['0.139s markup\n'])

It seems that this regex failed due to the slowest-reading-duration output that contains a timing for a docname with a directory path separator:

====================== slowest reading durations =======================
0.256s subdir/includes
0.139s markup

How to Reproduce

$ git checkout 4ea0d9fef464390694cc600fda89a924c2336b69
$ rm tests/roots/test-root/*.txt
$ touch tests/roots/test-root/index.txt
$ pytest tests/test_extensions/test_ext_duration.py

Environment Information

Platform:              linux; (Linux-6.17.8+deb14-amd64-x86_64-with-glibc2.41)
Python version:        3.13.9 (main, Oct 15 2025, 14:56:22) [GCC 15.2.0])
Python implementation: CPython
Sphinx version:        9.0.0+/4ea0d9fef
Docutils version:      0.22.3
Jinja2 version:        3.1.6
Pygments version:      2.19.2

Sphinx extensions

N/A

Additional context

Edit: add additional-context reference.
Edit: add code block around repro steps, and annotate as shell-script syntax

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions