Switch back to running tests for one backend only

This seems to cause unpredictable failures with pastebin (at least).
Tests will have the backends attribute if they really want to tests all
backends at once. For now, one backend is chosen for each run (and since
tests are ran often, it will cover all backends eventually.) The backend
instance name is displayed to ease the debugging.
This commit is contained in:
Laurent Bachelier 2011-05-04 23:15:58 +02:00
commit 56fe4448d3

View file

@ -18,6 +18,8 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from unittest import TestCase
from random import choice
from nose.plugins.skip import SkipTest
from weboob.core import Weboob
@ -30,14 +32,17 @@ class BackendTest(TestCase):
def __init__(self, *args, **kwargs):
TestCase.__init__(self, *args, **kwargs)
self.backend = None
self.backends = {}
self.backend_instance = None
self.backend = None
self.weboob = Weboob()
if self.weboob.load_backends(modules=[self.BACKEND]):
# provide the tests with all available backends
self.backends = self.weboob.backend_instances
else:
self.backends = {}
# chose one backend (enough for most tests)
self.backend_instance = choice(self.backends.keys())
self.backend = self.backends[self.backend_instance]
def run(self, result):
"""
@ -49,11 +54,7 @@ class BackendTest(TestCase):
result.startTest(self)
result.stopTest(self)
raise SkipTest()
for backend_instance, backend in self.backends.iteritems():
self.backend = backend
self.backend_instance = backend_instance
TestCase.run(self, result)
TestCase.run(self, result)
finally:
self.weboob.deinit()