Skip to content

Commit

Permalink
Merge pull request #40 from zopefoundation/drop-unittest2
Browse files Browse the repository at this point in the history
Drop conditional 'unittest2' dependency.
  • Loading branch information
tseaver committed Jun 21, 2016
2 parents 4a845e7 + 933a53e commit fcecc7d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 30 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Expand Up @@ -9,6 +9,9 @@ zope.testrunner Changelog
(because the testrunner replaced ``sys.stdin`` with an unclosable
object).

- Drop conditional dependency on ``unittest2`` (redundant after dropping
support for Python 2.6).


4.5.0 (2016-05-02)
==================
Expand Down
2 changes: 0 additions & 2 deletions setup.py
Expand Up @@ -36,8 +36,6 @@
)
else:
tests_require = ['zope.testing', 'python-subunit']
if sys.version_info[0:2] == (2, 6):
tests_require.append('unittest2')
extra = dict(tests_require = tests_require,
extras_require = {'test': tests_require})

Expand Down
10 changes: 1 addition & 9 deletions src/zope/testrunner/runner.py
Expand Up @@ -15,20 +15,15 @@
"""
from __future__ import print_function

import collections
import subprocess
import errno
import gc
import inspect
import re
import sys
import threading
import time
import traceback
try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest

from six import StringIO
from zope.testrunner.find import import_name
Expand Down Expand Up @@ -353,9 +348,6 @@ def run_tests(options, tests, name, failures, errors, skipped, import_errors):
# Python versions prior to 2.7 do not have the concept of
# unexpectedSuccesses.
failures.extend(result.unexpectedSuccesses)
if not hasattr(result, 'skipped'):
# Only in Python >= 2.7, Python >= 3.1, and when using unittest2
result.skipped = []
skipped.extend(result.skipped)
errors.extend(result.errors)
output.summary(n_tests=result.testsRun,
Expand Down
22 changes: 7 additions & 15 deletions src/zope/testrunner/tests/test_doctest.py
Expand Up @@ -299,21 +299,13 @@ def test_suite():
)
)

skip_feature = True
if sys.version_info < (2, 7, 0):
try:
import unittest2
except ImportError:
skip_feature = False

if skip_feature:
suites.append(
doctest.DocFileSuite(
'testrunner-report-skipped.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE,
checker=checker)
)
suites.append(
doctest.DocFileSuite(
'testrunner-report-skipped.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE,
checker=checker)
)

if hasattr(sys, 'gettotalrefcount'):
suites.append(
Expand Down
Expand Up @@ -12,10 +12,7 @@
#
##############################################################################

try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest


class TestSkipppedWithLayer(unittest.TestCase):
Expand Down

0 comments on commit fcecc7d

Please sign in to comment.