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

Update TestConfigInclude._test_passed to support Python 3.11 #304

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions cmakelang/test/config_include_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ def _list2reason(self, exc_list):

def _test_passed(self):
# Taken from https://stackoverflow.com/a/39606065/141023
if hasattr(self, '_outcome'): # Python 3.4+
# these 2 methods have no side effects
result = self.defaultTestResult()
# pylint: disable=no-member
self._feedErrorsToResult(result, self._outcome.errors)
else: # Python 3.2 - 3.3 or 3.0 - 3.1 and 2.7
result = getattr(
self, '_outcomeForDoCleanups',
self._resultForDoCleanups) # pylint: disable=no-member
if hasattr(self._outcome, 'errors'):
# Python 3.4 - 3.10 (These two methods have no side effects)
result = self.defaultTestResult()
self._feedErrorsToResult(result, self._outcome.errors)
else:
# Python 3.11+
result = self._outcome.result

error = self._list2reason(result.errors)
failure = self._list2reason(result.failures)
Expand Down