# HG changeset patch # User cmlenz # Date 1133177225 0 # Node ID c042e2c7048c57e0c920069e99a95d8560b34111 # Parent d4b59f1dc7f12d74ea60fb9cb3b2ba3bf433f631 Minor cleanup. diff --git a/bitten/queue.py b/bitten/queue.py --- 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 diff --git a/bitten/slave.py b/bitten/slave.py --- 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) diff --git a/bitten/tests/queue.py b/bitten/tests/queue.py --- 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) diff --git a/bitten/trac_ext/api.py b/bitten/trac_ext/api.py --- 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 diff --git a/bitten/trac_ext/summarizers.py b/bitten/trac_ext/summarizers.py --- 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): diff --git a/bitten/trac_ext/web_ui.py b/bitten/trac_ext/web_ui.py --- 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."""