changeset 318:c042e2c7048c

Minor cleanup.
author cmlenz
date Mon, 28 Nov 2005 11:27:05 +0000
parents d4b59f1dc7f1
children cd95e1c6e648
files bitten/queue.py bitten/slave.py bitten/tests/queue.py bitten/trac_ext/api.py bitten/trac_ext/summarizers.py bitten/trac_ext/web_ui.py
diffstat 6 files changed, 13 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/queue.py
+++ b/bitten/queue.py
@@ -149,7 +149,6 @@
             repos.sync()
 
             db = self.env.get_db_cnx()
-            build = None
             builds = []
             for config in BuildConfig.select(self.env, db=db):
                 for platform, rev, build in collect_changes(repos, config, db):
@@ -157,16 +156,15 @@
                         log.info('Enqueuing build of configuration "%s" at '
                                  'revision [%s] on %s', config.name, rev,
                                  platform.name)
-                        build = Build(self.env)
-                        build.config = config.name
-                        build.rev = str(rev)
-                        build.rev_time = repos.get_changeset(rev).date
-                        build.platform = platform.id
+                        build = Build(self.env, config=config.name,
+                                      platform=platform.id, rev=str(rev),
+                                      rev_time = repos.get_changeset(rev).date)
                         builds.append(build)
                         break
             for build in builds:
                 build.insert(db=db)
-                db.commit()
+            db.commit()
+
         finally:
             repos.close()
 
@@ -204,8 +202,6 @@
         any_match = False
         for config in BuildConfig.select(self.env):
             for platform in TargetPlatform.select(self.env, config=config.name):
-                if not platform.id in self.slaves:
-                    self.slaves[platform.id] = []
                 match = True
                 for propname, pattern in ifilter(None, platform.rules):
                     try:
@@ -221,7 +217,7 @@
                 if match:
                     log.debug('Slave %s matched target platform "%s"', name,
                               platform.name)
-                    self.slaves[platform.id].append(name)
+                    self.slaves.setdefault(platform.id, []).append(name)
                     any_match = True
         return any_match
 
--- a/bitten/slave.py
+++ b/bitten/slave.py
@@ -170,7 +170,6 @@
                 names = []
                 for tarinfo in tar_file:
                     if tarinfo.isfile() or tarinfo.isdir():
-                        log.debug('Extracting %s to %s', tarinfo.name, project_dir)
                         if tarinfo.name.startswith('/') or '..' in tarinfo.name:
                             continue
                         names.append(tarinfo.name)
--- a/bitten/tests/queue.py
+++ b/bitten/tests/queue.py
@@ -210,7 +210,7 @@
 
         queue = BuildQueue(self.env)
         assert not queue.register_slave('foo', {'family': 'nt'})
-        self.assertEqual([], queue.slaves[platform.id])
+        self.assertRaises(KeyError, queue.slaves.__getitem__, platform.id)
 
     def test_register_slave_match_regexp(self):
         BuildConfig(self.env, 'test', active=True).insert()
@@ -241,7 +241,7 @@
 
         queue = BuildQueue(self.env)
         assert not queue.register_slave('foo', {'version': '7.8.1'})
-        self.assertEqual([], queue.slaves[platform.id])
+        self.assertRaises(KeyError, queue.slaves.__getitem__, platform.id)
 
     def test_register_slave_match_regexp_invalid(self):
         BuildConfig(self.env, 'test', active=True).insert()
@@ -251,7 +251,7 @@
 
         queue = BuildQueue(self.env)
         assert not queue.register_slave('foo', {'version': '7.8.1'})
-        self.assertEqual([], queue.slaves[platform.id])
+        self.assertRaises(KeyError, queue.slaves.__getitem__, platform.id)
 
     def test_unregister_slave_no_builds(self):
         queue = BuildQueue(self.env)
--- a/bitten/trac_ext/api.py
+++ b/bitten/trac_ext/api.py
@@ -70,8 +70,8 @@
         component supports."""
 
     def render_summary(req, config, build, step, category):
-        """Render a summary for the given report and return the results HTML as
-        a string.
+        """Render a summary for the given report and return the resulting HTML
+        as string.
         
         @param req: the request object
         @param config: the build configuration
--- a/bitten/trac_ext/summarizers.py
+++ b/bitten/trac_ext/summarizers.py
@@ -65,7 +65,7 @@
         return hdf.render('bitten_summary_tests.cs')
 
 
-class CodeCoverageSummarizer(Component):
+class TestCoverageSummarizer(Component):
     implements(IReportSummarizer)
 
     def get_supported_categories(self):
--- a/bitten/trac_ext/web_ui.py
+++ b/bitten/trac_ext/web_ui.py
@@ -62,6 +62,7 @@
     }
     return hdf
 
+
 class BittenChrome(Component):
     """Provides the Bitten templates and static resources."""
 
Copyright (C) 2012-2017 Edgewall Software