You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Mo DeJong <su...@bayarea.net> on 2001/12/10 07:38:12 UTC

delete tests cases for basic_tests.py

Here is a patch to add test cases for file delete and directory delete.
The first demonstrates a well known bug with the file access method
and the second checks for a bug that has already been patched.

cheers
Mo

2001-12-09  Mo DeJong  <su...@bayarea.net>

	* subversion/tests/clients/cmdline/basic_tests.py
	(basic_delete, basic_delete_dir): Add tests for
	file delete and directory delete. The file delete
	test currently fails when using the file: protocol.

Index: ./subversion/tests/clients/cmdline/basic_tests.py
===================================================================
--- ./subversion/tests/clients/cmdline/.svn/text-base/basic_tests.py.svn-base	Wed Dec  5 06:59:17 2001
+++ ./subversion/tests/clients/cmdline/basic_tests.py	Sun Dec  9 23:17:21 2001
@@ -521,6 +521,114 @@
 
 #----------------------------------------------------------------------
 
+def basic_delete():
+  "basic delete command"
+
+  sbox = sandbox(basic_delete)
+  wc_dir = os.path.join (svntest.main.general_wc_dir, sbox)
+  
+  if svntest.actions.make_repo_and_wc(sbox):
+    return 1
+
+  # Add new file and commit it
+  foo_path = os.path.join(wc_dir, 'foo.c')
+  svntest.main.file_append (foo_path, 'foo data')
+  svntest.main.run_svn(None, 'add', foo_path)
+
+  # Created expected output tree for 'svn commit'
+  output_list = [ [foo_path, None, {}, {'verb' : 'Adding' }] ]
+
+  expected_output_tree = svntest.tree.build_generic_tree(output_list)
+
+  # Create expected status tree for 'svn commit'
+  status_list = svntest.actions.get_virginal_status_list(wc_dir, '2')
+
+  # FIXME: Why can't we pass both wc and repo revisions to above func?
+  for item in status_list:
+      item[3]['wc_rev'] = '1'
+
+  item = [foo_path, None, {},
+            {'status' : '_ ',
+             'wc_rev' : '2',
+             'repos_rev' : '2'}]
+
+  status_list.append(item)
+
+  expected_status_tree = svntest.tree.build_generic_tree(status_list)
+
+  if svntest.actions.run_and_verify_commit (wc_dir,
+                                            expected_output_tree,
+                                            expected_status_tree,
+                                            None,
+                                            None, None,
+                                            None, None,
+                                            wc_dir):
+    return 1;
+
+  # Now remove the newely added file and run 'svn commit'
+  svntest.main.run_svn(None, 'delete', foo_path)
+
+  # Created expected output tree for 'svn commit'
+  output_list = [ [foo_path, None, {}, {'verb' : 'Deleting' }] ]
+
+  expected_output_tree = svntest.tree.build_generic_tree(output_list)
+
+  # Foo should now be deleted and head revision should be 3
+  status_list = svntest.actions.get_virginal_status_list(wc_dir, '3')
+
+  # FIXME: Why can't we pass both wc and repo revisions to above func?
+  for item in status_list:
+      item[3]['wc_rev'] = '1'
+
+  return svntest.actions.run_and_verify_commit (wc_dir,
+                                                expected_output_tree,
+                                                expected_status_tree,
+                                                None,
+                                                None, None,
+                                                None, None,
+                                                wc_dir)
+
+#----------------------------------------------------------------------
+
+def basic_delete_dir():
+  "basic delete dir command"
+
+  sbox = sandbox(basic_delete_dir)
+  wc_dir = os.path.join (svntest.main.general_wc_dir, sbox)
+  
+  if svntest.actions.make_repo_and_wc(sbox):
+    return 1
+
+  # Add new directory
+  newdir_path = os.path.join(wc_dir, 'newdir')
+  svntest.main.run_svn(None, 'mkdir', newdir_path)
+
+  # Check status of new dir
+  status_list = svntest.actions.get_virginal_status_list(wc_dir, '1')
+
+  item = [newdir_path, None, {},
+            {'status' : 'A ',
+             'wc_rev' : '0',
+             'repos_rev' : '1'}]
+
+  status_list.append(item)
+
+  expected_status_tree = svntest.tree.build_generic_tree(status_list)
+
+  if svntest.actions.run_and_verify_status (wc_dir, expected_status_tree):
+    return 1
+
+  # Delete newely added directory
+  svntest.main.run_svn(None, 'rm', newdir_path)
+
+  # Ensure that there is no .svn directory in the now removed dir
+  admin_dir = os.path.join (newdir_path, svntest.main.get_admin_name())
+  if os.path.exists(admin_dir):
+    return 1
+
+#----------------------------------------------------------------------
+
+
 
 ########################################################################
 # Run the tests
@@ -536,6 +644,8 @@
               basic_conflict,
               basic_cleanup,
               basic_revert,
+              basic_delete,
+              basic_delete_dir,
               ### todo: more tests needed:
               ### test "svn rm http://some_url"
               ### not sure this file is the right place, though.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: delete tests cases for basic_tests.py

Posted by cm...@collab.net.
Mo DeJong <su...@bayarea.net> writes:

> Here is a patch to add test cases for file delete and directory delete.
> The first demonstrates a well known bug with the file access method
> and the second checks for a bug that has already been patched.
> 
> cheers
> Mo
> 
> 2001-12-09  Mo DeJong  <su...@bayarea.net>
> 
> 	* subversion/tests/clients/cmdline/basic_tests.py
> 	(basic_delete, basic_delete_dir): Add tests for
> 	file delete and directory delete. The file delete
> 	test currently fails when using the file: protocol.

I started to apply this patch, and then it rang a bell of familiarity
to me.  Aha!  Now I remember.

Mo, if you'll check out schedule_tests.py, you'll see the following:

- a bunch of helper functions that schedule working copy changes
  (FUNX, we'll call them) and verify that those changes took.

- a bunch of tests that call FUNX (and therefore, only test the
  scheduling of things)

- a bunch of tests that call FUNX, then call `svn revert` and test the
  revert functionality.

- a bunch of tests that call FUNX, then call `svn commit` -- oh, but
  those aren't written yet.

So, when I created schedule_tests, I wanted to make it so that anybody
can, without repeating too much code, check the scheduling, revert,
and commit, all in one place.

It would rock if, instead of my application of your patch, you would
simply fill in those 5 currently-commented-out commit functions (two
of which test file and dir deletions like your patch does).

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org