Skip to content

Commit

Permalink
need to use '_TextTestResult' to stay backwards compatible with Pytho…
Browse files Browse the repository at this point in the history
…n 2.6
  • Loading branch information
Chris NeJame committed Jun 22, 2017
1 parent 5de3c47 commit 3396af2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions contextional/tests/tools.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from __future__ import absolute_import

import unittest
from unittest import (
_TextTestResult,
TextTestRunner,
)


class FakeStream(object):
Expand All @@ -15,14 +18,14 @@ def flush(self):
pass


class TextTestResultHolder(unittest.runner.TextTestResult):
class TextTestResultHolder(_TextTestResult):

def printErrors(self):
self.test_run_output = self.stream.output.strip("\n").split("\n")
super(TextTestResultHolder, self).printErrors()


class SilentTestRunner(unittest.TextTestRunner):
class SilentTestRunner(TextTestRunner):

def __init__(self, *args, **kwargs):
kwargs["stream"] = FakeStream()
Expand Down

0 comments on commit 3396af2

Please sign in to comment.