[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] issue #2276 - 'svn info wcpath@X' returns repos lock - V2

From: Peter N. Lundblad <peter_at_famlundblad.se>
Date: 2005-09-21 11:33:36 CEST

On Wed, 21 Sep 2005, Alexander Thomas wrote:

> Index: subversion/tests/clients/cmdline/lock_tests.py
> ===================================================================
> --- subversion/tests/clients/cmdline/lock_tests.py (revision 16117)
> +++ subversion/tests/clients/cmdline/lock_tests.py (working copy)
> @@ -1225,7 +1225,51 @@
> # Make sure the file is unlocked
> svntest.actions.run_and_verify_status(wc_dir, expected_status)
>
> +#----------------------------------------------------------------------
> +def repos_lock_with_info(sbox):
> + "verify info path@X or path -rY return repos lock"
>
> + sbox.build()
> + wc_dir = sbox.wc_dir
> +
> + fname = 'iota'
> + comment = 'This is a lock test.'
> + file_path = os.path.join(sbox.wc_dir, fname)
> + file_url = svntest.main.current_repo_url + '/' + fname
> +
> + # lock wc file
> + svntest.actions.run_and_verify_svn(None, None, [], 'lock',
> + '--username', svntest.main.wc_author2,
> + '--password', svntest.main.wc_passwd,
> + '--no-auth-cache',
> + '-m', comment, file_path)
> +
> + # stealing lock on wc file
> + svntest.actions.run_and_verify_svn(None, None, [], 'lock',
> + '--username', svntest.main.wc_author2,
> + '--password', svntest.main.wc_passwd,
> + '--no-auth-cache',
> + '--force',
> + '-m', comment, file_url)

YOu need to run svn status (use run_and_verify_stats) to make sure that the file lock is really stolen. (Say that the second command fails, for example, but without writing to stderr).

> + # Getting repository lock token
> + output, err = svntest.actions.run_and_verify_svn(None, None, [], 'info',
> + file_url)
> + lock_token = output[-6][28:]
> +

This will fail unnecessarily when we add a new line to the svn info output. But, we won't change the header "LOck Token:", so you can look for that.

> + # info with revision
> + output, err = svntest.actions.run_and_verify_svn(None, None, [], 'info',
> + file_path, '-r1')
> + if (output[-6][28:] != lock_token):
> + print "Error: expected repository lock information not found."
> + raise svntest.Failure
> +
> + # info with peg revision
> + output, err = svntest.actions.run_and_verify_svn(None, None, [], 'info',
> + file_path + '@1')
> + if (output[-6][28:] != lock_token):

Same here.

Erik Heulsmann wrote an excelent introduction to test case writing which
is worth aread. It is in notes/test-writing.

Thanks,
//Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Sep 21 11:37:55 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.