# HG changeset patch # User Denis Laxalde # Date 1427289656 -3600 # Node ID b71511460a4f98b746bb49c7da18d1dcb856c659 # Parent af639c960eaefb734711c059d9d3a96f20924da8 [devtools/testlib] Remove assertions about direct usage of CubicWebTC/AutomaticWebTest The point is to be able to use a test runner other than pytest (e.g. nose2, nosetests or py.test) to run CubicWeb test suite. The issue is that most other test loaders inspects members of all base classes of test case classes to determine test methods and it hits this `config` property (actually executing it), which breaks the assertion. So just return None instead of failing. Closes #7817147. diff -r af639c960eae -r b71511460a4f devtools/testlib.py --- a/devtools/testlib.py Fri Nov 06 17:02:09 2015 +0100 +++ b/devtools/testlib.py Wed Mar 25 14:20:56 2015 +0100 @@ -326,8 +326,11 @@ Configuration is cached on the test class. """ + if cls is CubicWebTC: + # Prevent direct use of CubicWebTC directly to avoid database + # caching issues + return None try: - assert not cls is CubicWebTC, "Don't use CubicWebTC directly to prevent database caching issue" return cls.__dict__['_config'] except KeyError: home = abspath(join(dirname(sys.modules[cls.__module__].__file__), cls.appid)) @@ -1256,7 +1259,10 @@ tags = AutoPopulateTest.tags | Tags('web', 'generated') def setUp(self): - assert not self.__class__ is AutomaticWebTest, 'Please subclass AutomaticWebTest to prevent database caching issue' + if self.__class__ is AutomaticWebTest: + # Prevent direct use of AutomaticWebTest to avoid database caching + # issues. + return super(AutomaticWebTest, self).setUp() # access to self.app for proper initialization of the authentication