Skip to content

test_ssl: non_linux_skip_if_other_okay_error assumes err.reason is a string #126499

Closed

Description

@encukou

Recently, test_ssl has been failing intermittently but frequently on macOS buildbots, see for example here.

Since #108315, there's some code to skip tests, which does getattr(err, "reason", "") on an arbitrary exception and expects that to be a string. If reason is set to None, a regex search on it fails. This prevents the calling test from checking that the error is correct.

Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_ssl.py", line 5085, in test_preauth_data_to_tls_server
    self.non_linux_skip_if_other_okay_error(wrap_error)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_ssl.py", line 5032, in non_linux_skip_if_other_okay_error
    re.search('wrong.version.number', getattr(err, "reason", ""), re.I)):
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/re/__init__.py", line 177, in search
    return _compile(pattern, flags).search(string)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'

I'll send a PR soon.

Linked PRs

Activity

  1. self-assigned this
    on Nov 6, 2024
  2. added 2 commits that reference this issue on Nov 6, 2024
  3. encukou commented on Nov 7, 2024

    @encukou
    MemberAuthor

    I'll watch the buildbot for a day or two before backporting the fix.

  4. added 2 commits that reference this issue on Nov 8, 2024
  5. added 2 commits that reference this issue on Nov 11, 2024
  6. added a commit that references this issue on Dec 8, 2024
  7. added a commit that references this issue on Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions