3de7cde04f0b

tests: rename files to args
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 19 Jun 2010 02:25:49 -0400
parents 40e13965af72
children f8bca5fc564b
branches/tags (none)
files review/tests/test_comment.py review/tests/test_delete.py review/tests/test_diffs.py review/tests/util.py

Changes

--- a/review/tests/test_comment.py	Sat Jun 19 02:22:48 2010 -0400
+++ b/review/tests/test_comment.py	Sat Jun 19 02:25:49 2010 -0400
@@ -87,17 +87,17 @@
 
 @with_setup(setup_reviewed_sandbox, teardown_sandbox)
 def test_add_comments_to_file():
-    review(comment=True, message='Test comment one.', rev='1', files=['file_one'])
+    review(comment=True, message='Test comment one.', rev='1', args=['file_one'])
 
-    output = review(rev='1', files=['file_one'])
+    output = review(rev='1', args=['file_one'])
     assert a1 in output
     assert a2 in output
     assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment one.' in output
 
-    output = review(rev='1', files=['file_two'])
+    output = review(rev='1', args=['file_two'])
     assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment one.' not in output
 
-    output = review(rev='0', files=['file_one'])
+    output = review(rev='0', args=['file_one'])
     assert a1 not in output
     assert a2 not in output
     assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment one.' not in output
@@ -105,19 +105,19 @@
 @with_setup(setup_reviewed_sandbox, teardown_sandbox)
 def test_add_comments_to_multiple_files():
     review(comment=True, message='Test comment.', rev='1',
-        files=['file_one', 'always_changing'])
+        args=['file_one', 'always_changing'])
 
     output = review(rev='1')
     assert output.count(messages.REVIEW_LOG_COMMENT_LINE % 'Test comment.') == 2
 
     should_fail_with(messages.COMMENT_LINES_REQUIRE_FILE,
                      comment=True, rev='1', message='Test bad comment.', lines='1',
-                     files=['file_one', 'always_changing'])
+                     args=['file_one', 'always_changing'])
 
 @with_setup(setup_reviewed_sandbox, teardown_sandbox)
 def test_add_comments_to_bad_file():
     should_fail_with(messages.COMMENT_FILE_DOES_NOT_EXIST % ('bad', '2'),
-                     comment=True, message='Test comment one.', files=['bad'])
+                     comment=True, message='Test comment one.', args=['bad'])
 
 @with_setup(setup_reviewed_sandbox, teardown_sandbox)
 def test_add_comments_to_file_line():
@@ -125,9 +125,9 @@
                      comment=True, rev='1', message='Test bad comment.', lines='1')
 
     review(comment=True, rev='1', message='Test comment one.',
-        files=['file_one'], lines='1')
+        args=['file_one'], lines='1')
 
-    output = review(rev='1', files=['file_one'])
+    output = review(rev='1', args=['file_one'])
 
     # Make sure the comment is present at all.
     assert a1 in output
@@ -144,9 +144,9 @@
 @with_setup(setup_reviewed_sandbox, teardown_sandbox)
 def test_add_comments_to_file_lines():
     review(comment=True, rev='1', message='Test comment one.',
-        files=['file_one'], lines='1,2')
+        args=['file_one'], lines='1,2')
 
-    output = review(rev='1', files=['file_one'])
+    output = review(rev='1', args=['file_one'])
 
     # Make sure the comment is present at all.
     assert a1 in output
@@ -164,17 +164,17 @@
 def test_add_comments_to_file_in_subdir():
     filename = os.path.join('test_dir', 'test_file')
 
-    review(comment=True, message='Test comment one.', rev='1', files=[filename])
+    review(comment=True, message='Test comment one.', rev='1', args=[filename])
 
-    output = review(rev='1', files=[filename])
+    output = review(rev='1', args=[filename])
     assert a1 in output
     assert a2 in output
     assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment one.' in output
 
-    output = review(rev='1', files=['file_two'])
+    output = review(rev='1', args=['file_two'])
     assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment one.' not in output
 
-    output = review(rev='0', files=[filename])
+    output = review(rev='0', args=[filename])
     assert a1 not in output
     assert a2 not in output
     assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment one.' not in output
@@ -182,17 +182,17 @@
 @with_setup(setup_reviewed_sandbox, teardown_sandbox)
 def test_add_comments_to_file_in_cwd():
     os.chdir('test_dir')
-    review(comment=True, message='Test comment one.', rev='1', files=['test_file'])
+    review(comment=True, message='Test comment one.', rev='1', args=['test_file'])
 
-    output = review(rev='1', files=['test_file'])
+    output = review(rev='1', args=['test_file'])
     assert a1 in output
     assert a2 in output
     assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment one.' in output
 
-    output = review(rev='1', files=['file_two'])
+    output = review(rev='1', args=['file_two'])
     assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment one.' not in output
 
-    output = review(rev='0', files=['test_file'])
+    output = review(rev='0', args=['test_file'])
     assert a1 not in output
     assert a2 not in output
     assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment one.' not in output
@@ -202,24 +202,24 @@
     filename = os.path.join('..', 'file_three')
 
     os.chdir('test_dir')
-    review(comment=True, message='Test comment one.', rev='1', files=[filename])
+    review(comment=True, message='Test comment one.', rev='1', args=[filename])
 
-    output = review(rev='1', files=[filename])
+    output = review(rev='1', args=[filename])
     assert a1 in output
     assert a2 in output
     assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment one.' in output
 
-    output = review(rev='1', files=['file_two'])
+    output = review(rev='1', args=['file_two'])
     assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment one.' not in output
 
-    output = review(rev='0', files=[filename])
+    output = review(rev='0', args=[filename])
     assert a1 not in output
     assert a2 not in output
     assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment one.' not in output
 
 @with_setup(setup_reviewed_sandbox, teardown_sandbox)
 def test_comment_identifiers():
-    review(comment=True, message='Test comment one.', rev='1', files=['file_one'])
+    review(comment=True, message='Test comment one.', rev='1', args=['file_one'])
 
     rd = api.ReviewDatastore(get_ui(), get_sandbox_repo())
     dsr = get_datastore_repo()
--- a/review/tests/test_delete.py	Sat Jun 19 02:22:48 2010 -0400
+++ b/review/tests/test_delete.py	Sat Jun 19 02:25:49 2010 -0400
@@ -18,11 +18,11 @@
     # TODO: rename files.
 
     should_fail_with(messages.DELETE_REQUIRES_IDS, delete=True)
-    should_fail_with(messages.DELETE_UNKNOWN_ID % 'a', delete=True, files=['a'])
+    should_fail_with(messages.DELETE_UNKNOWN_ID % 'a', delete=True, args=['a'])
 
     review(comment=True, message='test')
 
-    should_fail_with(messages.DELETE_UNKNOWN_ID % 'z', delete=True, files=['z'])
+    should_fail_with(messages.DELETE_UNKNOWN_ID % 'z', delete=True, args=['z'])
 
     # Use the pidgeonhole princicple to create ambiguous identifiers.
     for i in range(17):
@@ -34,7 +34,7 @@
         id_map[i[0]] = id_map.get(i[0], 0) + 1
     i = str(filter(lambda k: id_map[k] > 1, id_map.keys())[0])
 
-    should_fail_with(messages.DELETE_AMBIGUOUS_ID % i, delete=True, files=[i])
+    should_fail_with(messages.DELETE_AMBIGUOUS_ID % i, delete=True, args=[i])
 
 @with_setup(setup_reviewed_sandbox, teardown_sandbox)
 def test_delete_comment():
@@ -42,7 +42,7 @@
         review(rev=rev, comment=True, message='test')
         i = _get_identifiers(rev)[0]
 
-        output = review(rev=rev, delete=True, files=[i])
+        output = review(rev=rev, delete=True, args=[i])
         assert not output
         output = review(rev=rev, verbose=True)
         assert '(%s)\n' % i not in output
@@ -51,7 +51,7 @@
         review(rev=rev, comment=True, message='test3')
         i1, i2 = _get_identifiers(rev)
 
-        output = review(rev=rev, delete=True, files=[i1])
+        output = review(rev=rev, delete=True, args=[i1])
         assert not output
         output = review(rev=rev, verbose=True)
         assert '(%s)\n' % i1 not in output
@@ -60,7 +60,7 @@
         review(rev=rev, comment=True, message='test4')
         i1, i2 = _get_identifiers(rev)
 
-        output = review(rev=rev, delete=True, files=[i1, i2])
+        output = review(rev=rev, delete=True, args=[i1, i2])
         assert not output
         output = review(rev=rev, verbose=True)
         assert '(%s)\n' % i1 not in output
@@ -74,7 +74,7 @@
     review(signoff=True, message='test')
     i = _get_identifiers()[0]
 
-    output = review(delete=True, files=[i])
+    output = review(delete=True, args=[i])
     assert not output
     output = review(verbose=True)
     assert '(%s)\n' % i not in output
@@ -83,7 +83,7 @@
     review(signoff=True, message='test3')
     i1, i2 = _get_identifiers()
 
-    output = review(delete=True, files=[i2])
+    output = review(delete=True, args=[i2])
     assert not output
     output = review(verbose=True)
     assert '(%s)\n' % i1 in output
@@ -96,7 +96,7 @@
         review(rev=rev, comment=True, message='test')
         ids = _get_identifiers(rev)
 
-        output = review(rev=rev, delete=True, files=ids)
+        output = review(rev=rev, delete=True, args=ids)
         assert not output
         output = review(rev=rev, verbose=True)
         assert '(%s)\n' % ids[0] not in output
@@ -107,7 +107,7 @@
         review(rev=rev, comment=True, message='test4')
         ids = _get_identifiers(rev)
 
-        output = review(rev=rev, delete=True, files=ids[:2])
+        output = review(rev=rev, delete=True, args=ids[:2])
         assert not output
         output = review(rev=rev, verbose=True)
         assert '(%s)\n' % ids[0] not in output
--- a/review/tests/test_diffs.py	Sat Jun 19 02:22:48 2010 -0400
+++ b/review/tests/test_diffs.py	Sat Jun 19 02:25:49 2010 -0400
@@ -7,7 +7,7 @@
 
 @with_setup(setup_reviewed_sandbox, teardown_sandbox)
 def test_review_diff_default_context():
-    output = review(rev='1', files=['long_file'], unified='5')
+    output = review(rev='1', args=['long_file'], unified='5')
 
     assert ' 0:' not in output
     assert messages.REVIEW_LOG_SKIPPED % 1 in output
@@ -25,7 +25,7 @@
 
 @with_setup(setup_reviewed_sandbox, teardown_sandbox)
 def test_review_diff_full_context():
-    output = review(rev='1', files=['long_file'], unified='10000')
+    output = review(rev='1', args=['long_file'], unified='10000')
 
     assert s1 not in output
     assert s2 not in output
@@ -35,7 +35,7 @@
 
 @with_setup(setup_reviewed_sandbox, teardown_sandbox)
 def test_review_diff_small_context():
-    output = review(rev='1', files=['long_file'], unified='2')
+    output = review(rev='1', args=['long_file'], unified='2')
 
     assert ' 3:' not in output
     assert messages.REVIEW_LOG_SKIPPED % 4 in output
@@ -55,9 +55,9 @@
 @with_setup(setup_reviewed_sandbox, teardown_sandbox)
 def test_review_diff_with_comment():
     review(comment=True, rev='1', message='Test comment one.',
-        files=['long_file'], lines='6,7')
+        args=['long_file'], lines='6,7')
 
-    output = review(rev='1', files=['long_file'], unified=0)
+    output = review(rev='1', args=['long_file'], unified=0)
 
     # Make sure the comment is present at all.
     assert a1 in output
@@ -74,9 +74,9 @@
 @with_setup(setup_reviewed_sandbox, teardown_sandbox)
 def test_review_diff_with_skipped_comment():
     review(comment=True, rev='1', message='Test comment one.',
-        files=['long_file'], lines='3')
+        args=['long_file'], lines='3')
 
-    output = review(rev='1', files=['long_file'], unified=0)
+    output = review(rev='1', args=['long_file'], unified=0)
 
     # Make sure the comment is present at all.
     assert a1 in output
--- a/review/tests/util.py	Sat Jun 19 02:22:48 2010 -0400
+++ b/review/tests/util.py	Sat Jun 19 02:25:49 2010 -0400
@@ -12,18 +12,17 @@
 _ui.setconfig('extensions', 'progress', '!')
 def review(init=False, comment=False, signoff=False, check=False, yes=False,
     no=False, force=False, message='', rev='.', remote_path='', lines='',
-    files=None, unified='5', web=False, verbose=False, debug=False, mdown=False,
+    args=None, unified='5', web=False, verbose=False, debug=False, mdown=False,
     seen=False, yeses='', no_nos=False, delete=False):
 
-    if not files:
-        files = []
+    args = args or []
 
     _ui.pushbuffer()
     if debug:
         _ui.debugflag = True
     elif verbose:
         _ui.verbose = True
-    cli.review(_ui, get_sandbox_repo(), *files,
+    cli.review(_ui, get_sandbox_repo(), *args,
         **dict(
             init=init, comment=comment, signoff=signoff, check=check, yes=yes,
             no=no, force=force, message=message, rev=rev, remote_path=remote_path,