cubicweb/devtools/testlib.py
changeset 11744 a6dc650bc230
parent 11725 904ee9cd0cf9
child 11748 c6d37774f4d0
equal deleted inserted replaced
11743:48d70d143dc1 11744:a6dc650bc230
    24 from os.path import dirname, join, abspath
    24 from os.path import dirname, join, abspath
    25 from math import log
    25 from math import log
    26 from contextlib import contextmanager
    26 from contextlib import contextmanager
    27 from inspect import isgeneratorfunction
    27 from inspect import isgeneratorfunction
    28 from itertools import chain
    28 from itertools import chain
       
    29 import tempfile
    29 
    30 
    30 from six import text_type, string_types
    31 from six import text_type, string_types
    31 from six.moves import range
    32 from six.moves import range
    32 from six.moves.urllib.parse import urlparse, parse_qs, unquote as urlunquote
    33 from six.moves.urllib.parse import urlparse, parse_qs, unquote as urlunquote
    33 
    34 
    54 
    55 
    55 if sys.version_info[:2] < (3, 4):
    56 if sys.version_info[:2] < (3, 4):
    56     from unittest2 import TestCase
    57     from unittest2 import TestCase
    57     if not hasattr(TestCase, 'subTest'):
    58     if not hasattr(TestCase, 'subTest'):
    58         raise ImportError('no subTest support in available unittest2')
    59         raise ImportError('no subTest support in available unittest2')
       
    60     from backports.tempfile import TemporaryDirectory  # noqa
    59 else:
    61 else:
    60     from unittest import TestCase
    62     from unittest import TestCase
       
    63     from tempfile import TemporaryDirectory  # noqa
    61 
    64 
    62 # in python 2.7, DeprecationWarning are not shown anymore by default
    65 # in python 2.7, DeprecationWarning are not shown anymore by default
    63 warnings.filterwarnings('default', category=DeprecationWarning)
    66 warnings.filterwarnings('default', category=DeprecationWarning)
    64 
    67 
    65 
    68