"Fossies" - the Fresh Open Source Software Archive

Member "buildbot-2.3.1/buildbot/test/unit/test_scripts_tryserver.py" (23 May 2019, 1682 Bytes) of package /linux/misc/buildbot-2.3.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. See also the last Fossies "Diffs" side-by-side code changes report for "test_scripts_tryserver.py": 1.8.0_vs_2.0.0.

    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 import os
   17 import sys
   18 
   19 from twisted.python.compat import NativeStringIO
   20 from twisted.trial import unittest
   21 
   22 from buildbot.scripts import tryserver
   23 from buildbot.test.util import dirs
   24 
   25 
   26 class TestStatusLog(dirs.DirsMixin, unittest.TestCase):
   27 
   28     def setUp(self):
   29         self.newdir = os.path.join('jobdir', 'new')
   30         self.tmpdir = os.path.join('jobdir', 'tmp')
   31         self.setUpDirs("jobdir", self.newdir, self.tmpdir)
   32 
   33     def test_trycmd(self):
   34         config = dict(jobdir='jobdir')
   35         inputfile = NativeStringIO('this is my try job')
   36         self.patch(sys, 'stdin', inputfile)
   37 
   38         rc = tryserver.tryserver(config)
   39 
   40         self.assertEqual(rc, 0)
   41 
   42         newfiles = os.listdir(self.newdir)
   43         tmpfiles = os.listdir(self.tmpdir)
   44         self.assertEqual((len(newfiles), len(tmpfiles)),
   45                          (1, 0))
   46         with open(os.path.join(self.newdir, newfiles[0]), 'rt') as f:
   47             self.assertEqual(f.read(), 'this is my try job')