summaryrefslogtreecommitdiff
path: root/tests/test_runner
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-03-25 10:33:54 +0100
committerGitHub <noreply@github.com>2021-03-25 10:33:54 +0100
commit5b618f239ceb884c9380cf42361c7cc69bf1e208 (patch)
tree8dbdb1dc7a964f280688ef063902424250f191a4 /tests/test_runner
parente53159747c53ca8db6c338998493fd8697d38fac (diff)
downloaddjango-5b618f239ceb884c9380cf42361c7cc69bf1e208.tar.gz
Fixed RemoteTestResultTest tests without tblib.
Follow up to e3bca22e7e572b0274a0814c7869c899d7b544e0.
Diffstat (limited to 'tests/test_runner')
-rw-r--r--tests/test_runner/test_parallel.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/test_runner/test_parallel.py b/tests/test_runner/test_parallel.py
index a56d82c7bd..e27579831f 100644
--- a/tests/test_runner/test_parallel.py
+++ b/tests/test_runner/test_parallel.py
@@ -1,11 +1,12 @@
import pickle
+import sys
import unittest
from django.test import SimpleTestCase
from django.test.runner import RemoteTestResult
try:
- import tblib
+ import tblib.pickling_support
except ImportError:
tblib = None
@@ -52,6 +53,12 @@ class SampleFailingSubtest(SimpleTestCase):
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)
@@ -63,7 +70,7 @@ class RemoteTestResultTest(SimpleTestCase):
def test_was_successful_one_expected_failure(self):
result = RemoteTestResult()
- result.addExpectedFailure(None, ValueError('woops'))
+ result.addExpectedFailure(None, self._test_error_exc_info())
self.assertIs(result.wasSuccessful(), True)
def test_was_successful_one_skip(self):
@@ -71,14 +78,16 @@ class RemoteTestResultTest(SimpleTestCase):
result.addSkip(None, 'Skipped')
self.assertIs(result.wasSuccessful(), True)
+ @unittest.skipUnless(tblib is not None, 'requires tblib to be installed')
def test_was_successful_one_error(self):
result = RemoteTestResult()
- result.addError(None, ValueError('woops'))
+ result.addError(None, self._test_error_exc_info())
self.assertIs(result.wasSuccessful(), False)
+ @unittest.skipUnless(tblib is not None, 'requires tblib to be installed')
def test_was_successful_one_failure(self):
result = RemoteTestResult()
- result.addFailure(None, ValueError('woops'))
+ result.addFailure(None, self._test_error_exc_info())
self.assertIs(result.wasSuccessful(), False)
def test_picklable(self):