cubicweb/devtools/testlib.py
changeset 11182 66c44d3d97af
parent 11181 2a7fb3422ae1
child 11184 2a7b98d91736
equal deleted inserted replaced
11181:2a7fb3422ae1 11182:66c44d3d97af
    21 import sys
    21 import sys
    22 import re
    22 import re
    23 from os.path import dirname, join, abspath
    23 from os.path import dirname, join, abspath
    24 from math import log
    24 from math import log
    25 from contextlib import contextmanager
    25 from contextlib import contextmanager
       
    26 from inspect import isgeneratorfunction
    26 from itertools import chain
    27 from itertools import chain
    27 
    28 
    28 from six import text_type, string_types
    29 from six import text_type, string_types
    29 from six.moves import range
    30 from six.moves import range
    30 from six.moves.urllib.parse import urlparse, parse_qs, unquote as urlunquote
    31 from six.moves.urllib.parse import urlparse, parse_qs, unquote as urlunquote
   314     def __init__(self, *args, **kwargs):
   315     def __init__(self, *args, **kwargs):
   315         self._admin_session = None
   316         self._admin_session = None
   316         self.repo = None
   317         self.repo = None
   317         self._open_access = set()
   318         self._open_access = set()
   318         super(CubicWebTC, self).__init__(*args, **kwargs)
   319         super(CubicWebTC, self).__init__(*args, **kwargs)
       
   320 
       
   321     def run(self, *args, **kwds):
       
   322         testMethod = getattr(self, self._testMethodName)
       
   323         if isgeneratorfunction(testMethod):
       
   324             raise RuntimeError(
       
   325                 '%s appears to be a generative test. This is not handled '
       
   326                 'anymore, use subTest API instead.' % self)
       
   327         return super(CubicWebTC, self).run(*args, **kwds)
   319 
   328 
   320     # repository connection handling ###########################################
   329     # repository connection handling ###########################################
   321 
   330 
   322     def new_access(self, login):
   331     def new_access(self, login):
   323         """provide a new RepoAccess object for a given user
   332         """provide a new RepoAccess object for a given user