Skip to content

Commit

Permalink
Removed redundant RemoteTestResultTest._test_error_exc_info() test hook.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixxm authored and sarahboyce committed Nov 11, 2024
1 parent 398cec4 commit 2bc43cc
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions tests/test_runner/test_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
tblib = None


def _test_error_exc_info():
try:
raise ValueError("woops")
except ValueError:
return sys.exc_info()


class ExceptionThatFailsUnpickling(Exception):
"""
After pickling, this class fails unpickling with an error about incorrect
Expand Down Expand Up @@ -75,12 +82,6 @@ def dummy_test(self):


class RemoteTestResultTest(SimpleTestCase):
def _test_error_exc_info(self):
try:
raise ValueError("woops")
except ValueError:
return sys.exc_info()

def test_was_successful_no_events(self):
result = RemoteTestResult()
self.assertIs(result.wasSuccessful(), True)
Expand All @@ -100,7 +101,7 @@ def test_was_successful_one_expected_failure(self):
test = None
result.startTest(test)
try:
result.addExpectedFailure(test, self._test_error_exc_info())
result.addExpectedFailure(test, _test_error_exc_info())
finally:
result.stopTest(test)
self.assertIs(result.wasSuccessful(), True)
Expand All @@ -121,7 +122,7 @@ def test_was_successful_one_error(self):
test = None
result.startTest(test)
try:
result.addError(test, self._test_error_exc_info())
result.addError(test, _test_error_exc_info())
finally:
result.stopTest(test)
self.assertIs(result.wasSuccessful(), False)
Expand All @@ -132,7 +133,7 @@ def test_was_successful_one_failure(self):
test = None
result.startTest(test)
try:
result.addFailure(test, self._test_error_exc_info())
result.addFailure(test, _test_error_exc_info())
finally:
result.stopTest(test)
self.assertIs(result.wasSuccessful(), False)
Expand All @@ -143,7 +144,7 @@ def test_add_error_before_first_test(self):
test_id = "test_foo (tests.test_foo.FooTest.test_foo)"
test = _ErrorHolder(test_id)
# Call addError() without a call to startTest().
result.addError(test, self._test_error_exc_info())
result.addError(test, _test_error_exc_info())

(event,) = result.events
self.assertEqual(event[0], "addError")
Expand Down Expand Up @@ -283,10 +284,3 @@ def test_handle_add_success(self):

self.assertEqual(len(result.errors), 0)
self.assertEqual(len(result.failures), 0)


def _test_error_exc_info():
try:
raise ValueError("woops")
except ValueError:
return sys.exc_info()

0 comments on commit 2bc43cc

Please sign in to comment.