From 7d3f886c77a5d2b55b97ab7ef233f340bc5a464e Mon Sep 17 00:00:00 2001 From: Nick Coghlan <@ncoghlan> Date: Tue, 1 May 2012 20:42:19 +1000 Subject: [PATCH] Fallback to unittest2 when necessary --- NEWS.rst | 2 +- setup.py | 3 +++ test_contextlib2.py | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/NEWS.rst b/NEWS.rst index d8b3e5e..8553b0a 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -4,7 +4,7 @@ Release History 0.4.0 (2012-05-??) ~~~~~~~~~~~~~~~~~~ -* TBD +* Fall back to unittest2 if unittest is missing required functionality 0.3.1 (2012-01-17) diff --git a/setup.py b/setup.py index 1544eef..0c897f4 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,9 @@ #!/usr/bin/env python from distutils.core import setup +# Technically, unittest2 is a dependency to run the tests on 2.6 and 3.1 +# Not sure how best to express that cleanly here + setup( name='contextlib2', version=open('VERSION.txt').read().strip(), diff --git a/test_contextlib2.py b/test_contextlib2.py index f83f217..c4bb09b 100755 --- a/test_contextlib2.py +++ b/test_contextlib2.py @@ -1,8 +1,11 @@ #!/usr/bin/env python -"""Unit tests for contextlib.py, and other context managers.""" +"""Unit tests for contextlib2""" import sys + import unittest +if not hasattr(unittest, "skipIf"): + import unittest2 as unittest from contextlib2 import * # Tests __all__