"Fossies" - the Fresh Open Source Software Archive

Member "buildbot-2.5.1/buildbot/test/util/reporter.py" (24 Nov 2019, 3736 Bytes) of package /linux/misc/buildbot-2.5.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # This file is part of Buildbot.  Buildbot is free software: you can
    2 # redistribute it and/or modify it under the terms of the GNU General Public
    3 # License as published by the Free Software Foundation, version 2.
    4 #
    5 # This program is distributed in the hope that it will be useful, but WITHOUT
    6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    7 # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    8 # details.
    9 #
   10 # You should have received a copy of the GNU General Public License along with
   11 # this program; if not, write to the Free Software Foundation, Inc., 51
   12 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   13 #
   14 # Copyright Buildbot Team Members
   15 
   16 from buildbot.test.fake import fakedb
   17 
   18 
   19 class ReporterTestMixin:
   20 
   21     TEST_PROJECT = 'testProject'
   22     TEST_REPO = 'https://example.org/repo'
   23     TEST_REVISION = 'd34db33fd43db33f'
   24     TEST_CODEBASE = 'cbgerrit'
   25     TEST_CHANGE_ID = 'I5bdc2e500d00607af53f0fa4df661aada17f81fc'
   26     TEST_BUILDER_NAME = 'Builder0'
   27     TEST_PROPS = {
   28         'Stash_branch': 'refs/changes/34/1234/1',
   29         'project': TEST_PROJECT,
   30         'got_revision': TEST_REVISION,
   31         'revision': TEST_REVISION,
   32         'event.change.id': TEST_CHANGE_ID,
   33         'event.change.project': TEST_PROJECT,
   34         'branch': 'refs/pull/34/merge',
   35     }
   36     THING_URL = 'http://thing.example.com'
   37 
   38     def insertTestData(self, buildResults, finalResult, insertSS=True):
   39         self.db = self.master.db
   40         self.db.insertTestData([
   41             fakedb.Master(id=92),
   42             fakedb.Worker(id=13, name='wrk'),
   43             fakedb.Builder(id=79, name='Builder0'),
   44             fakedb.Builder(id=80, name='Builder1'),
   45             fakedb.Buildset(id=98, results=finalResult, reason="testReason1"),
   46             fakedb.Change(changeid=13, branch='master', revision='9283', author='me@foo',
   47                           repository=self.TEST_REPO, codebase=self.TEST_CODEBASE,
   48                           project='world-domination', sourcestampid=234),
   49         ])
   50 
   51         if insertSS:
   52             self.db.insertTestData([
   53                 fakedb.BuildsetSourceStamp(buildsetid=98, sourcestampid=234),
   54                 fakedb.SourceStamp(
   55                     id=234,
   56                     project=self.TEST_PROJECT,
   57                     revision=self.TEST_REVISION,
   58                     repository=self.TEST_REPO,
   59                     codebase=self.TEST_CODEBASE)
   60             ])
   61 
   62         for i, results in enumerate(buildResults):
   63             self.db.insertTestData([
   64                 fakedb.BuildRequest(
   65                     id=11 + i, buildsetid=98, builderid=79 + i),
   66                 fakedb.Build(id=20 + i, number=i, builderid=79 + i, buildrequestid=11 + i, workerid=13,
   67                              masterid=92, results=results, state_string="buildText"),
   68                 fakedb.Step(id=50 + i, buildid=20 + i, number=5, name='make'),
   69                 fakedb.Log(id=60 + i, stepid=50 + i, name='stdio', slug='stdio', type='s',
   70                            num_lines=7),
   71                 fakedb.LogChunk(logid=60 + i, first_line=0, last_line=1, compressed=0,
   72                                 content='Unicode log with non-ascii (\u00E5\u00E4\u00F6).'),
   73                 fakedb.BuildProperty(
   74                     buildid=20 + i, name="workername", value="wrk"),
   75                 fakedb.BuildProperty(
   76                     buildid=20 + i, name="reason", value="because"),
   77                 fakedb.BuildProperty(
   78                     buildid=20 + i, name="buildername", value="Builder0"),
   79             ])
   80             for k, v in self.TEST_PROPS.items():
   81                 self.db.insertTestData([
   82                     fakedb.BuildProperty(buildid=20 + i, name=k, value=v)
   83                 ])