Skip to content

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

@encukou

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 (mostrecentcalllast): File"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_ssl.py", line5085, intest_preauth_data_to_tls_serverself.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", line5032, innon_linux_skip_if_other_okay_errorre.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", line177, insearchreturn_compile(pattern, flags).search(string) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^TypeError: expectedstringorbytes-likeobject, got'NoneType'

I'll send a PR soon.

Linked PRs

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions