Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
encukou opened this issue Nov 6, 2024 · 1 comment
Closed
Assignees
Labels
tests Tests in the Lib/test dir topic-SSL

Comments

@encukou
Copy link
Member

encukou commented Nov 6, 2024

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

@encukou encukou self-assigned this Nov 6, 2024
@ZeroIntensity ZeroIntensity added tests Tests in the Lib/test dir topic-SSL labels Nov 6, 2024
encukou added a commit to encukou/cpython that referenced this issue Nov 6, 2024
The skipping machinery called `getattr(err, "reason", "")` on an arbitrary
exception. As intermittent Buildbot failures show, sometimes it's set
to None.

Convert it to string for this specific check.
encukou added a commit that referenced this issue Nov 7, 2024
The skipping machinery called `getattr(err, "reason", "")` on an arbitrary
exception. As intermittent Buildbot failures show, sometimes it's set
to None.

Convert it to string for this specific check.
@encukou
Copy link
Member Author

encukou commented Nov 7, 2024

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

@encukou encukou added needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes and removed needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes labels Nov 8, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 8, 2024
…nGH-126501)

The skipping machinery called `getattr(err, "reason", "")` on an arbitrary
exception. As intermittent Buildbot failures show, sometimes it's set
to None.

Convert it to string for this specific check.
(cherry picked from commit 78ad7e6)

Co-authored-by: Petr Viktorin <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 8, 2024
…nGH-126501)

The skipping machinery called `getattr(err, "reason", "")` on an arbitrary
exception. As intermittent Buildbot failures show, sometimes it's set
to None.

Convert it to string for this specific check.
(cherry picked from commit 78ad7e6)

Co-authored-by: Petr Viktorin <[email protected]>
encukou added a commit that referenced this issue Nov 11, 2024
…26501) (GH-126574)

gh-126499: test_ssl: Don't assume err.reason is a string (GH-126501)

The skipping machinery called `getattr(err, "reason", "")` on an arbitrary
exception. As intermittent Buildbot failures show, sometimes it's set
to None.

Convert it to string for this specific check.
(cherry picked from commit 78ad7e6)

Co-authored-by: Petr Viktorin <[email protected]>
encukou added a commit that referenced this issue Nov 11, 2024
…26501) (GH-126573)

gh-126499: test_ssl: Don't assume err.reason is a string (GH-126501)

The skipping machinery called `getattr(err, "reason", "")` on an arbitrary
exception. As intermittent Buildbot failures show, sometimes it's set
to None.

Convert it to string for this specific check.
(cherry picked from commit 78ad7e6)

Co-authored-by: Petr Viktorin <[email protected]>
@encukou encukou closed this as completed Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir topic-SSL
Projects
None yet
Development

No branches or pull requests

2 participants