Rev 2406: Cleanup bzrlib/benchmarks/* so that everything at least has a valid doc string. in http://bzr.arbash-meinel.com/branches/bzr/0.16-dev/doc-cleanup

John Arbash Meinel john at arbash-meinel.com
Mon Apr 9 23:11:48 BST 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.16-dev/doc-cleanup

------------------------------------------------------------
revno: 2406
revision-id: john at arbash-meinel.com-20070409221122-qh66j4pk3kqxjn9c
parent: john at arbash-meinel.com-20070409212132-23n1qlamaypsbluo
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: doc-cleanup
timestamp: Mon 2007-04-09 17:11:22 -0500
message:
  Cleanup bzrlib/benchmarks/* so that everything at least has a valid doc string.
modified:
  bzrlib/benchmarks/__init__.py  __init__.py-20060516064526-eb0d37c78e86065d
  bzrlib/benchmarks/bench_add.py bench_add.py-20060516064526-6342399b2967266c
  bzrlib/benchmarks/bench_bench.py bench_bench.py-20060609084943-2lv2wsi61vhkmj7b-1
  bzrlib/benchmarks/bench_cache_utf8.py bench_encoding.py-20060810000746-nv69wfkxei7w2cij-1
  bzrlib/benchmarks/bench_checkout.py bench_checkout.py-20060521233052-b52eba18ee46046b
  bzrlib/benchmarks/bench_commit.py bench_commit.py-20060522031508-4ea2551904e4becb
  bzrlib/benchmarks/bench_inventory.py bench_inventory.py-20060611112709-gjo1kx0oudyo9qbv-1
  bzrlib/benchmarks/bench_log.py bench_log.py-20060611214524-mr18tk29h8v0qb4x-1
  bzrlib/benchmarks/bench_osutils.py bench_osutils.py-20060608153714-apso8cyz1bu2z1ig-1
  bzrlib/benchmarks/bench_rocks.py bench_rocks.py-20060608120339-3ydxl3v2cori44zb-1
  bzrlib/benchmarks/bench_sftp.py bench_sftp.py-20060810114659-67c1edb27503ebde
  bzrlib/benchmarks/bench_startup.py bench_startup.py-20061006075337-q49on3zvfcbvarn3-1
  bzrlib/benchmarks/bench_status.py bench_status.py-20060520215801-2cc60f6da5625927
  bzrlib/benchmarks/bench_transform.py bench_transform.py-20060525041052-ysn0hlw94gcc57lm-1
  bzrlib/benchmarks/bench_workingtree.py bench_workingtree.py-20060527061822-cxrgsa9ax2q4d82q-1
  bzrlib/benchmarks/bench_xml.py bench_xml.py-20060816202544-ty0p415bb7om5gzd-1
  bzrlib/benchmarks/tree_creator/kernel_like.py kernel_like.py-20060815024128-b16a7pn542u6b13k-1
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
-------------- next part --------------
=== modified file 'bzrlib/benchmarks/__init__.py'
--- a/bzrlib/benchmarks/__init__.py	2006-10-16 01:25:46 +0000
+++ b/bzrlib/benchmarks/__init__.py	2007-04-09 22:11:22 +0000
@@ -26,16 +26,19 @@
 
 
 class Benchmark(ExternalBase):
+    """A Test class which provides helpers for writing benchmark tests."""
 
     def make_kernel_like_tree(self, url=None, root='.',
                               link_working=False):
         """Setup a temporary tree roughly like a kernel tree.
-        
+
         :param url: Creat the kernel like tree as a lightweight checkout
-        of a new branch created at url.
+            of a new branch created at url.
+        :param root: Path where the tree will be created.
         :param link_working: instead of creating a new copy of all files
             just hardlink the working tree. Tests must request this, because
             they must break links if they want to change the files
+        :return: A newly created tree.
         """
         from bzrlib.benchmarks.tree_creator.kernel_like import (
             KernelLikeTreeCreator,
@@ -131,7 +134,7 @@
                             hardlink=False):
         """Create a tree with many files and many commits. Every commit changes
         exactly one file.
-        
+
         :param num_files: number of files to be created
         :param num_commits: number of commits in the newly created tree
         """
@@ -153,8 +156,8 @@
         :param tree: The tree in which the changes happen.
         :param files: The list of files where changes should occur.
         :param num_commits: The number of commits
-        :param changes_per_commit: The number of files that are touched in 
-        each commit.
+        :param changes_per_commit: The number of files that are touched in
+            each commit.
         """
         for j in range(num_commits):
             for i in range(changes_per_commit):

=== modified file 'bzrlib/benchmarks/bench_add.py'
--- a/bzrlib/benchmarks/bench_add.py	2006-10-11 23:08:27 +0000
+++ b/bzrlib/benchmarks/bench_add.py	2007-04-09 22:11:22 +0000
@@ -21,6 +21,7 @@
 
 
 class AddBenchmark(Benchmark):
+    """Benchmarks for 'bzr add'"""
 
     def test_one_add_kernel_like_tree(self):
         """Adding a kernel sized tree should be bearable (<5secs) fast.""" 

=== modified file 'bzrlib/benchmarks/bench_bench.py'
--- a/bzrlib/benchmarks/bench_bench.py	2006-10-11 23:08:27 +0000
+++ b/bzrlib/benchmarks/bench_bench.py	2007-04-09 22:11:22 +0000
@@ -29,6 +29,7 @@
 
 
 class MakeKernelLikeTreeBenchmark(Benchmark):
+    """Benchmark creating benchmark trees."""
 
     def test_make_kernel_like_tree(self):
         """Making a kernel sized tree should be ~ 5seconds on modern disk.""" 

=== modified file 'bzrlib/benchmarks/bench_cache_utf8.py'
--- a/bzrlib/benchmarks/bench_cache_utf8.py	2006-11-28 16:00:17 +0000
+++ b/bzrlib/benchmarks/bench_cache_utf8.py	2007-04-09 22:11:22 +0000
@@ -35,6 +35,7 @@
 
 
 class EncodingBenchmark(Benchmark):
+    """Benchmark the time to encode strings."""
 
     def setUp(self):
         super(EncodingBenchmark, self).setUp()
@@ -134,7 +135,9 @@
                      unicode("%07d" % x) for x in xrange(500000)]
         self.time(self.encode_cached_multi, revisions, 1)
 
+
 class DecodingBenchmarks(Benchmark):
+    """Benchmark the time to decode strings."""
 
     def setUp(self):
         super(DecodingBenchmarks, self).setUp()

=== modified file 'bzrlib/benchmarks/bench_checkout.py'
--- a/bzrlib/benchmarks/bench_checkout.py	2006-10-11 23:08:27 +0000
+++ b/bzrlib/benchmarks/bench_checkout.py	2007-04-09 22:11:22 +0000
@@ -21,6 +21,7 @@
 
 
 class CheckoutBenchmark(Benchmark):
+    """Benchmarks for ``'bzr checkout'`` performance."""
 
     def test_build_kernel_like_tree(self):
         """Checkout of a clean kernel sized tree should be (<10secs)."""

=== modified file 'bzrlib/benchmarks/bench_commit.py'
--- a/bzrlib/benchmarks/bench_commit.py	2006-10-16 01:25:46 +0000
+++ b/bzrlib/benchmarks/bench_commit.py	2007-04-09 22:11:22 +0000
@@ -24,6 +24,7 @@
 
 
 class CommitBenchmark(Benchmark):
+    """Benchmarks for ``bzr commit``"""
 
     def test_commit_kernel_like_tree(self):
         """Commit of a fresh import of a clean kernel sized tree."""

=== modified file 'bzrlib/benchmarks/bench_inventory.py'
--- a/bzrlib/benchmarks/bench_inventory.py	2006-10-11 23:08:27 +0000
+++ b/bzrlib/benchmarks/bench_inventory.py	2007-04-09 22:11:22 +0000
@@ -14,14 +14,15 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-"""Tests for bzr add performance."""
-
-
-import bzrlib
+"""Tests for `bzrlib.inventory.Inventory` performance."""
+
+
+import bzrlib.inventory
 from bzrlib.benchmarks import Benchmark
 
 
 class InvBenchmark(Benchmark):
+    """Benchmarks for building large inventories."""
 
     def test_make_10824_inv_entries(self):
         """Making 10824 inv entries should be quick."""

=== modified file 'bzrlib/benchmarks/bench_log.py'
--- a/bzrlib/benchmarks/bench_log.py	2006-10-11 23:08:27 +0000
+++ b/bzrlib/benchmarks/bench_log.py	2007-04-09 22:11:22 +0000
@@ -26,24 +26,45 @@
 from bzrlib.transform import TreeTransform
 from bzrlib.workingtree import WorkingTree
 
+
 class LinesDone(Exception):
+    """Raised when `LineConsumer` reaches the required number of lines."""
     pass
 
+
 class LineConsumer(object):
+    """Count lines that are produced.
+
+    When the required number of lines have been reached, raise `LinesDone`.
+    """
 
     def __init__(self, required_lines):
+        """Create a new consumer.
+
+        :param required_lines: How many lines must be produced.
+        :type required_lines: integer
+        """
         self.required_lines = required_lines
 
     def write(self, text):
+        """Write some text to the black hole.
+
+        But count how many lines have been written.
+
+        :param text: A string that would be written.
+        :raise LinesDone: when the required number of lines has been reached.
+        :return: None
+        """
         self.required_lines -= text.count('\n')
         if self.required_lines < 0:
             raise LinesDone()
-        
+
 
 class LogBenchmark(Benchmark):
+    """Benchmarks for ``'bzr log'`` performance."""
 
     def test_log(self):
-        """Run log in a many-commit tree.""" 
+        """Run log in a many-commit tree."""
         tree = self.make_many_commit_tree(hardlink=True)
         lf = log_formatter('long', to_file=StringIO())
         self.time(show_log, tree.branch, lf, direction='reverse')

=== modified file 'bzrlib/benchmarks/bench_osutils.py'
--- a/bzrlib/benchmarks/bench_osutils.py	2006-10-11 23:08:27 +0000
+++ b/bzrlib/benchmarks/bench_osutils.py	2007-04-09 22:11:22 +0000
@@ -22,6 +22,7 @@
 
 
 class WalkDirsBenchmark(Benchmark):
+    """Benchmarks for `bzrlib.osutils.walkdirs`"""
 
     def test_walkdirs_kernel_like_tree(self):
         """Walking a kernel sized tree is fast!(150ms)."""

=== modified file 'bzrlib/benchmarks/bench_rocks.py'
--- a/bzrlib/benchmarks/bench_rocks.py	2006-10-16 01:25:46 +0000
+++ b/bzrlib/benchmarks/bench_rocks.py	2007-04-09 22:11:22 +0000
@@ -21,6 +21,7 @@
 
 
 class RocksBenchmark(Benchmark):
+    """Benchmarks for ``'bzr rocks'``"""
 
     def test_rocks(self):
         """Test the startup overhead by running a do-nothing command"""

=== modified file 'bzrlib/benchmarks/bench_sftp.py'
--- a/bzrlib/benchmarks/bench_sftp.py	2006-10-11 23:08:27 +0000
+++ b/bzrlib/benchmarks/bench_sftp.py	2007-04-09 22:11:22 +0000
@@ -93,6 +93,8 @@
 
 
 class SFTPSlowSocketBenchmark(SFTPBenchmark):
+    """Benchmarks of SFTP performance with a 30ms delay per roundtrip."""
+
     def setUp(self):
         super(SFTPSlowSocketBenchmark, self).setUp()
         self.get_server().add_latency = 0.03

=== modified file 'bzrlib/benchmarks/bench_startup.py'
--- a/bzrlib/benchmarks/bench_startup.py	2006-10-16 01:25:46 +0000
+++ b/bzrlib/benchmarks/bench_startup.py	2007-04-09 22:11:22 +0000
@@ -21,6 +21,7 @@
 
 
 class StartupBenchmark(Benchmark):
+    """Benchmark startup costs for certain bzr commands."""
 
     def make_simple_tree(self):
         """A small, simple tree. No caching needed"""

=== modified file 'bzrlib/benchmarks/bench_status.py'
--- a/bzrlib/benchmarks/bench_status.py	2007-02-02 04:53:48 +0000
+++ b/bzrlib/benchmarks/bench_status.py	2007-04-09 22:11:22 +0000
@@ -21,6 +21,7 @@
 
 
 class StatusBenchmark(Benchmark):
+    """Benchmarks for ``'bzr status'``."""
 
     def test_no_ignored_unknown_kernel_like_tree(self):
         """Status in a kernel sized tree with no ignored or unknowns.

=== modified file 'bzrlib/benchmarks/bench_transform.py'
--- a/bzrlib/benchmarks/bench_transform.py	2006-10-11 23:08:27 +0000
+++ b/bzrlib/benchmarks/bench_transform.py	2007-04-09 22:11:22 +0000
@@ -23,7 +23,9 @@
 from bzrlib.transform import TreeTransform
 from bzrlib.workingtree import WorkingTree
 
+
 class TransformBenchmark(Benchmark):
+    """Benchmarks for `bzrlib.transform`"""
 
     def test_canonicalize_path(self):
         """Canonicalizing paths should be fast.""" 

=== modified file 'bzrlib/benchmarks/bench_workingtree.py'
--- a/bzrlib/benchmarks/bench_workingtree.py	2007-02-15 18:32:24 +0000
+++ b/bzrlib/benchmarks/bench_workingtree.py	2007-04-09 22:11:22 +0000
@@ -24,6 +24,7 @@
 
 
 class WorkingTreeBenchmark(Benchmark):
+    """Benchmarks for `bzrlib.workingtree` performance."""
 
     def test_list_files_kernel_like_tree(self):
         tree = self.make_kernel_like_added_tree()

=== modified file 'bzrlib/benchmarks/bench_xml.py'
--- a/bzrlib/benchmarks/bench_xml.py	2006-10-11 23:08:27 +0000
+++ b/bzrlib/benchmarks/bench_xml.py	2007-04-09 22:11:22 +0000
@@ -24,6 +24,7 @@
 
 
 class BenchXMLSerializer(Benchmark):
+    """Benchmarks for serializing to/from XML."""
 
     def test_write_to_string_kernel_like_inventory(self):
         # On jam's machine, ElementTree serializer took: 2161ms/13487ms

=== modified file 'bzrlib/benchmarks/tree_creator/kernel_like.py'
--- a/bzrlib/benchmarks/tree_creator/kernel_like.py	2006-10-11 23:08:27 +0000
+++ b/bzrlib/benchmarks/tree_creator/kernel_like.py	2007-04-09 22:11:22 +0000
@@ -31,7 +31,7 @@
 
 
 class KernelLikeTreeCreator(TreeCreator):
-    """Create a basic tree with ~10k unversioned files""" 
+    """Create a basic tree with ~10k unversioned files"""
 
     def __init__(self, test, link_working=False, url=None):
         super(KernelLikeTreeCreator, self).__init__(test,
@@ -97,6 +97,7 @@
 
 
 class KernelLikeAddedTreeCreator(TreeCreator):
+    """Create a tree with ~10k versioned but not committed files"""
 
     def __init__(self, test, link_working=False, hot_cache=True):
         super(KernelLikeAddedTreeCreator, self).__init__(test,
@@ -188,11 +189,14 @@
         finally:
             f.close()
 
-    def create(self):
+    def create(self, root=None):
         """Create a kernel like inventory
 
+        :param root: Exists to mimic the base class, but this class
+            returns only an in-memory Inventory, so it should always be None.
         :return: An Inventory object.
         """
+        assert root is None, "Cannot create a memory inventory in a on disk."
         cache_dir = self._get_cache_dir()
         if cache_dir is None:
             return self._create_and_return()

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2007-04-09 21:21:32 +0000
+++ b/bzrlib/tests/__init__.py	2007-04-09 22:11:22 +0000
@@ -868,12 +868,13 @@
                 excName = str(excClass)
             raise self.failureException, "%s not raised" % excName
 
-    def assertRaises(self, excClass, func, *args, **kwargs):
+    def assertRaises(self, excClass, callableObj, *args, **kwargs):
         """Assert that a callable raises a particular exception.
 
         :param excClass: As for the except statement, this may be either an
             exception class, or a tuple of classes.
-        :param func: A callable, will be passed ``*args`` and ``**kwargs``.
+        :param callableObj: A callable, will be passed ``*args`` and
+            ``**kwargs``.
 
         Returns the exception so that you can examine it.
         """
@@ -1377,7 +1378,7 @@
         profiled or debugged so easily.
 
         :param process_args: a list of arguments to pass to the bzr executable,
-            for example `['--version']`.
+            for example ``['--version']``.
         :param env_changes: A dictionary which lists changes to environment
             variables. A value of None will unset the env variable.
             The values must be strings. The change will only occur in the



More information about the bazaar-commits mailing list