Rev 4331: Fixed as per John's and Markus reviews. in file:///home/vila/src/bzr/experimental/log-tests/

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri May 8 14:39:33 BST 2009


At file:///home/vila/src/bzr/experimental/log-tests/

------------------------------------------------------------
revno: 4331
revision-id: v.ladeuil+lp at free.fr-20090508133932-4fbx4z8fvraeyjdy
parent: v.ladeuil+lp at free.fr-20090507170330-smhj6usbtj2i2d4l
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: log-tests
timestamp: Fri 2009-05-08 15:39:32 +0200
message:
  Fixed as per John's and Markus reviews.
  
  * bzrlib/tests/blackbox/test_push.py:
  (TestPush.test_push_with_revisionspec): Fix wrong run_bzr_error
  call. Additionnally the error regexp was wrong !
  
  * bzrlib/tests/blackbox/test_ls.py:
  (TestLS.test_ls_path, TestLS.test_kinds): Fix wrong run_bzr_error
  calls.
  
  * bzrlib/tests/__init__.py:
  (TestCase.run_bzr): Add a check to catch errors in error_regexes
  usage where people use a a string that it then iterated char by
  char for matching (which is most certainly not the intent of the
  test writer).
  
  * bzrlib/tests/blackbox/test_log.py:
  Fix run_bzr_error calls. Fix some white spaces issues (some
  expected strings were using TABs and were wrongly caught by
  test_coding_style(), but fixing the strings wasn't really a
  problem either.
-------------- next part --------------
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2009-05-01 03:50:47 +0000
+++ b/bzrlib/tests/__init__.py	2009-05-08 13:39:32 +0000
@@ -1639,6 +1639,7 @@
             stdin=stdin,
             working_dir=working_dir,
             )
+        self.assertIsInstance(error_regexes, (list, tuple))
         for regex in error_regexes:
             self.assertContainsRe(err, regex)
         return out, err

=== modified file 'bzrlib/tests/blackbox/test_log.py'
--- a/bzrlib/tests/blackbox/test_log.py	2009-05-07 17:03:30 +0000
+++ b/bzrlib/tests/blackbox/test_log.py	2009-05-08 13:39:32 +0000
@@ -32,7 +32,7 @@
     def setUp(self):
         super(TestLog, self).setUp()
         self.timezone = 0 # UTC
-        self.timestamp =1132617600 # Mon 2005-11-22 00:00:00 +0000
+        self.timestamp = 1132617600 # Mon 2005-11-22 00:00:00 +0000
 
     def make_minimal_branch(self, path='.', format=None):
         tree = self.make_branch_and_tree(path, format=format)
@@ -72,7 +72,6 @@
         self.assertEqualDiff(expected, test_log.normalize_log(out))
 
 
-
 class TestLogRevSpecs(TestLog):
 
     def test_log_null_end_revspec(self):
@@ -103,17 +102,17 @@
 
     def test_log_zero_revspec(self):
         self.make_minimal_branch()
-        self.run_bzr_error('bzr: ERROR: Logging revision 0 is invalid.',
+        self.run_bzr_error(['bzr: ERROR: Logging revision 0 is invalid.'],
                            ['log', '-r0'])
 
     def test_log_zero_begin_revspec(self):
         self.make_linear_branch()
-        self.run_bzr_error('bzr: ERROR: Logging revision 0 is invalid.',
+        self.run_bzr_error(['bzr: ERROR: Logging revision 0 is invalid.'],
                            ['log', '-r0..2'])
 
     def test_log_zero_end_revspec(self):
         self.make_linear_branch()
-        self.run_bzr_error('bzr: ERROR: Logging revision 0 is invalid.',
+        self.run_bzr_error(['bzr: ERROR: Logging revision 0 is invalid.'],
                            ['log', '-r-2..0'])
 
     def test_log_negative_begin_revspec_full_log(self):
@@ -171,15 +170,17 @@
 
     def test_log_nonexistent_revno(self):
         self.make_minimal_branch()
-        (out, err) = self.run_bzr_error(args="log -r 1234",
-            error_regexes=["bzr: ERROR: Requested revision: '1234' "
-                           "does not exist in branch:"])
+        (out, err) = self.run_bzr_error(
+            ["bzr: ERROR: Requested revision: '1234' "
+             "does not exist in branch:"],
+            ['log', '-r1234'])
 
     def test_log_nonexistent_dotted_revno(self):
         self.make_minimal_branch()
-        (out, err) = self.run_bzr_error(args="log -r 123.123",
-            error_regexes=["bzr: ERROR: Requested revision: '123.123' "
-                "does not exist in branch:"])
+        (out, err) = self.run_bzr_error(
+            ["bzr: ERROR: Requested revision: '123.123' "
+             "does not exist in branch:"],
+            ['log',  '-r123.123'])
 
     def test_log_change_revno(self):
         self.make_linear_branch()
@@ -189,25 +190,27 @@
 
     def test_log_change_nonexistent_revno(self):
         self.make_minimal_branch()
-        (out, err) = self.run_bzr_error(args="log -c 1234",
-            error_regexes=["bzr: ERROR: Requested revision: '1234' "
-                           "does not exist in branch:"])
+        (out, err) = self.run_bzr_error(
+            ["bzr: ERROR: Requested revision: '1234' "
+             "does not exist in branch:"],
+            ['log',  '-c1234'])
 
     def test_log_change_nonexistent_dotted_revno(self):
         self.make_minimal_branch()
-        (out, err) = self.run_bzr_error(args="log -c 123.123",
-            error_regexes=["bzr: ERROR: Requested revision: '123.123' "
-                           "does not exist in branch:"])
+        (out, err) = self.run_bzr_error(
+            ["bzr: ERROR: Requested revision: '123.123' "
+             "does not exist in branch:"],
+            ['log', '-c123.123'])
 
     def test_log_change_single_revno_only(self):
         self.make_minimal_branch()
-        self.run_bzr_error('bzr: ERROR: Option --change does not'
-                           ' accept revision ranges',
+        self.run_bzr_error(['bzr: ERROR: Option --change does not'
+                           ' accept revision ranges'],
                            ['log', '--change', '2..3'])
 
     def test_log_change_incompatible_with_revision(self):
-        self.run_bzr_error('bzr: ERROR: --revision and --change'
-                           ' are mutually exclusive',
+        self.run_bzr_error(['bzr: ERROR: --revision and --change'
+                           ' are mutually exclusive'],
                            ['log', '--change', '2', '--revision', '3'])
 
     def test_log_nonexistent_file(self):
@@ -291,8 +294,8 @@
 
     def test_log_unsupported_timezone(self):
         self.make_linear_branch()
-        self.run_bzr_error('bzr: ERROR: Unsupported timezone format "foo", '
-                           'options are "utc", "original", "local".',
+        self.run_bzr_error(['bzr: ERROR: Unsupported timezone format "foo", '
+                            'options are "utc", "original", "local".'],
                            ['log', '--timezone', 'foo'])
 
 
@@ -537,8 +540,8 @@
   merge branch level1
 diff:
 === modified file 'file2'
---- file2	2005-11-22 00:00:01 +0000
-+++ file2	2005-11-22 00:00:02 +0000
+--- file2\t2005-11-22 00:00:01 +0000
++++ file2\t2005-11-22 00:00:02 +0000
 @@ -1,1 +1,1 @@
 -contents of level0/file2
 +hello
@@ -551,8 +554,8 @@
       in branch level1
     diff:
     === modified file 'file2'
-    --- file2	2005-11-22 00:00:01 +0000
-    +++ file2	2005-11-22 00:00:02 +0000
+    --- file2\t2005-11-22 00:00:01 +0000
+    +++ file2\t2005-11-22 00:00:02 +0000
     @@ -1,1 +1,1 @@
     -contents of level0/file2
     +hello
@@ -565,14 +568,14 @@
   in branch level0
 diff:
 === added file 'file1'
---- file1	1970-01-01 00:00:00 +0000
-+++ file1	2005-11-22 00:00:01 +0000
+--- file1\t1970-01-01 00:00:00 +0000
++++ file1\t2005-11-22 00:00:01 +0000
 @@ -0,0 +1,1 @@
 +contents of level0/file1
 
 === added file 'file2'
---- file2	1970-01-01 00:00:00 +0000
-+++ file2	2005-11-22 00:00:01 +0000
+--- file2\t1970-01-01 00:00:00 +0000
++++ file2\t2005-11-22 00:00:01 +0000
 @@ -0,0 +1,1 @@
 +contents of level0/file2
 """
@@ -583,8 +586,8 @@
     2 Lorem Ipsum\t2005-11-22 [merge]
       merge branch level1
       === modified file 'file2'
-      --- file2	2005-11-22 00:00:01 +0000
-      +++ file2	2005-11-22 00:00:02 +0000
+      --- file2\t2005-11-22 00:00:01 +0000
+      +++ file2\t2005-11-22 00:00:02 +0000
       @@ -1,1 +1,1 @@
       -contents of level0/file2
       +hello
@@ -592,14 +595,14 @@
     1 Lorem Ipsum\t2005-11-22
       in branch level0
       === added file 'file1'
-      --- file1	1970-01-01 00:00:00 +0000
-      +++ file1	2005-11-22 00:00:01 +0000
+      --- file1\t1970-01-01 00:00:00 +0000
+      +++ file1\t2005-11-22 00:00:01 +0000
       @@ -0,0 +1,1 @@
       +contents of level0/file1
 \x20\x20\x20\x20\x20\x20
       === added file 'file2'
-      --- file2	1970-01-01 00:00:00 +0000
-      +++ file2	2005-11-22 00:00:01 +0000
+      --- file2\t1970-01-01 00:00:00 +0000
+      +++ file2\t2005-11-22 00:00:01 +0000
       @@ -0,0 +1,1 @@
       +contents of level0/file2
 
@@ -621,8 +624,8 @@
     1 Lorem Ipsum\t2005-11-22
       in branch level0
       === added file 'file1'
-      --- file1	1970-01-01 00:00:00 +0000
-      +++ file1	2005-11-22 00:00:01 +0000
+      --- file1\t1970-01-01 00:00:00 +0000
+      +++ file1\t2005-11-22 00:00:01 +0000
       @@ -0,0 +1,1 @@
       +contents of level0/file1
 
@@ -635,8 +638,8 @@
     2 Lorem Ipsum\t2005-11-22 [merge]
       merge branch level1
       === modified file 'file2'
-      --- file2	2005-11-22 00:00:01 +0000
-      +++ file2	2005-11-22 00:00:02 +0000
+      --- file2\t2005-11-22 00:00:01 +0000
+      +++ file2\t2005-11-22 00:00:02 +0000
       @@ -1,1 +1,1 @@
       -contents of level0/file2
       +hello
@@ -644,8 +647,8 @@
     1 Lorem Ipsum\t2005-11-22
       in branch level0
       === added file 'file2'
-      --- file2	1970-01-01 00:00:00 +0000
-      +++ file2	2005-11-22 00:00:01 +0000
+      --- file2\t1970-01-01 00:00:00 +0000
+      +++ file2\t2005-11-22 00:00:01 +0000
       @@ -0,0 +1,1 @@
       +contents of level0/file2
 

=== modified file 'bzrlib/tests/blackbox/test_ls.py'
--- a/bzrlib/tests/blackbox/test_ls.py	2009-04-08 18:18:36 +0000
+++ b/bzrlib/tests/blackbox/test_ls.py	2009-05-08 13:39:32 +0000
@@ -166,7 +166,7 @@
                        'V        ../subdir/\n'
                        'V        ../subdir/b\n' ,
                        '.. --verbose')
-        self.run_bzr_error('cannot specify both --from-root and PATH',
+        self.run_bzr_error(['cannot specify both --from-root and PATH'],
                            'ls --from-root ..')
 
     def test_ls_revision(self):
@@ -235,7 +235,7 @@
                        '--kind=directory')
         self.ls_equals('',
                        '--kind=symlink')
-        self.run_bzr_error('invalid kind specified', 'ls --kind=pile')
+        self.run_bzr_error(['invalid kind specified'], 'ls --kind=pile')
 
     def test_ls_path_nonrecursive(self):
         self.ls_equals('%s/.bzrignore\n'

=== modified file 'bzrlib/tests/blackbox/test_push.py'
--- a/bzrlib/tests/blackbox/test_push.py	2009-04-29 04:14:26 +0000
+++ b/bzrlib/tests/blackbox/test_push.py	2009-05-08 13:39:32 +0000
@@ -306,7 +306,8 @@
         self.assertEqual(tree_to.branch.last_revision_info()[1], 'from-1')
 
         self.run_bzr_error(
-            "bzr: ERROR: bzr push --revision takes one value.\n",
+            ['bzr: ERROR: bzr push --revision '
+             'takes exactly one revision identifier\n'],
             'push -r0..2 ../to', working_dir='from')
 
     def create_trunk_and_feature_branch(self):

=== modified file 'bzrlib/tests/test_log.py'
--- a/bzrlib/tests/test_log.py	2009-05-06 08:17:44 +0000
+++ b/bzrlib/tests/test_log.py	2009-05-08 13:39:32 +0000
@@ -50,7 +50,6 @@
     """
 
     supports_delta = True
-#    supports_merge_revisions = True
 
     def __init__(self):
         super(LogCatcher, self).__init__(to_file=None)



More information about the bazaar-commits mailing list