Skip to content

Unexpanded f-strings in Lib/test/support/__init__.py exceptions #135074

Closed
@danielhollas

Description

@danielhollas
Contributor

Bug report

Bug description:

ruff check --target-version=py314 --preview --select RUF027 Lib/test/support/__init__.py 
Lib/test/support/__init__.py:1087:26: RUF027 Possible f-string without an `f` prefix
     |
1085 |     memlimit = _parse_memlimit(limit)
1086 |     if memlimit < _2G - 1:
1087 |         raise ValueError('Memory limit {limit!r} too low to be useful')
     |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF027
1088 |
1089 |     real_max_memuse = memlimit
     |
     = help: Add `f` prefix

Lib/test/support/__init__.py:2361:26: RUF027 Possible f-string without an `f` prefix
     |
2359 |         max_depth = 20_000
2360 |     elif max_depth < 3:
2361 |         raise ValueError("max_depth must be at least 3, got {max_depth}")
     |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF027
2362 |     depth = get_recursion_depth()
2363 |     depth = max(depth - 1, 1)  # Ignore infinite_recursion() frame.
     |
     = help: Add `f` prefix

Found 2 errors.

Related to #135069

I'll submit a PR shortly.

CPython versions tested on:

CPython main branch, 3.13, 3.14

Operating systems tested on:

No response

Linked PRs

Activity

added 2 commits that reference this issue on Jun 3, 2025

pythongh-135074: Fix exception messages in test.support module

pythongh-135074: Fix exception messages in test.support module

added a commit that references this issue on Jun 4, 2025

gh-135074: Fix exception messages in test.support module (GH-135076)

bc00ce9
added 2 commits that reference this issue on Jun 4, 2025

pythongh-135074: Fix exception messages in test.support module (pytho…

pythongh-135074: Fix exception messages in test.support module (pytho…

added 2 commits that reference this issue on Jun 4, 2025

[3.13] gh-135074: Fix exception messages in test.support module (GH-1…

70c7aad

[3.14] gh-135074: Fix exception messages in test.support module (GH-1…

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @danielhollas

      Issue actions

        Unexpanded f-strings in Lib/test/support/__init__.py exceptions · Issue #135074 · python/cpython