Use TestReactorMixin which seems to be required now.

This commit is contained in:
Marvin Pohl 2019-05-03 22:25:40 +02:00
parent 268541313e
commit 0455ca30c7
3 changed files with 17 additions and 5 deletions

View File

@ -17,17 +17,21 @@ from buildbot.test.fake import fakemaster
from buildbot.test.fake import httpclientservice as fakehttpclientservice from buildbot.test.fake import httpclientservice as fakehttpclientservice
from buildbot.test.util import logging from buildbot.test.util import logging
from buildbot.test.util.reporter import ReporterTestMixin from buildbot.test.util.reporter import ReporterTestMixin
from buildbot.test.util.misc import TestReactorMixin
class TestGiteaStatusPush( class TestGiteaStatusPush(
unittest.TestCase, unittest.TestCase,
ReporterTestMixin, ReporterTestMixin,
logging.LoggingMixin): logging.LoggingMixin,
TestReactorMixin):
# repository must be in the form http://gitea/<owner>/<project> # repository must be in the form http://gitea/<owner>/<project>
TEST_REPO = u'http://gitea/buildbot/buildbot' TEST_REPO = u'http://gitea/buildbot/buildbot'
@defer.inlineCallbacks @defer.inlineCallbacks
def setUp(self): def setUp(self):
self.setUpTestReactor()
# ignore config error if txrequests is not installed # ignore config error if txrequests is not installed
self.patch(config, '_errors', Mock()) self.patch(config, '_errors', Mock())
self.master = fakemaster.make_master(testcase=self, self.master = fakemaster.make_master(testcase=self,

View File

@ -24,12 +24,15 @@ from buildbot.test.fake.remotecommand import Expect
from buildbot.test.fake.remotecommand import ExpectShell from buildbot.test.fake.remotecommand import ExpectShell
from buildbot.test.util import config from buildbot.test.util import config
from buildbot.test.util import sourcesteps from buildbot.test.util import sourcesteps
from buildbot.test.util.misc import TestReactorMixin
class TestGitea(sourcesteps.SourceStepMixin, config.ConfigErrorsMixin, unittest.TestCase):
class TestGitea(sourcesteps.SourceStepMixin, config.ConfigErrorsMixin, unittest.TestCase, TestReactorMixin):
stepClass = Gitea stepClass = Gitea
def setUp(self): def setUp(self):
self.setUpTestReactor()
self.sourceName = self.stepClass.__name__ self.sourceName = self.stepClass.__name__
return self.setUpSourceStep() return self.setUpSourceStep()

View File

@ -1,6 +1,8 @@
import buildbot.www.change_hook as change_hook import buildbot.www.change_hook as change_hook
from buildbot.test.fake.web import FakeRequest from buildbot.test.fake.web import FakeRequest
from buildbot.test.fake.web import fakeMasterForHooks from buildbot.test.fake.web import fakeMasterForHooks
from buildbot.test.util.misc import TestReactorMixin
from twisted.internet import defer from twisted.internet import defer
@ -719,8 +721,9 @@ giteaJsonPullRequestPayloadMerged = rb"""
""" """
class TestChangeHookGiteaPush(unittest.TestCase): class TestChangeHookGiteaPush(unittest.TestCase, TestReactorMixin):
def setUp(self): def setUp(self):
self.setUpTestReactor()
self.changeHook = change_hook.ChangeHookResource( self.changeHook = change_hook.ChangeHookResource(
dialects={'gitea': {}}, dialects={'gitea': {}},
master=fakeMasterForHooks(self)) master=fakeMasterForHooks(self))
@ -828,8 +831,9 @@ class TestChangeHookGiteaPush(unittest.TestCase):
self.assertEqual(len(self.changeHook.master.data.updates.changesAdded), 0) self.assertEqual(len(self.changeHook.master.data.updates.changesAdded), 0)
class TestChangeHookGiteaPushOnlySingle(unittest.TestCase): class TestChangeHookGiteaPushOnlySingle(unittest.TestCase, TestReactorMixin):
def setUp(self): def setUp(self):
self.setUpTestReactor()
self.changeHook = change_hook.ChangeHookResource( self.changeHook = change_hook.ChangeHookResource(
dialects={'gitea': {"onlyIncludePushCommit": True}}, dialects={'gitea': {"onlyIncludePushCommit": True}},
master=fakeMasterForHooks(self)) master=fakeMasterForHooks(self))
@ -863,8 +867,9 @@ class TestChangeHookGiteaPushOnlySingle(unittest.TestCase):
self.checkChangesFromPush(res) self.checkChangesFromPush(res)
class TestChangeHookGiteaSecretPhrase(unittest.TestCase): class TestChangeHookGiteaSecretPhrase(unittest.TestCase, TestReactorMixin):
def setUp(self): def setUp(self):
self.setUpTestReactor()
self.changeHook = change_hook.ChangeHookResource( self.changeHook = change_hook.ChangeHookResource(
dialects={'gitea': {"secret": "test"}}, dialects={'gitea': {"secret": "test"}},
master=fakeMasterForHooks(self)) master=fakeMasterForHooks(self))