Rev 4921: (mbp) Add better example for ScriptRunner and tweak its place in the in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Dec 23 01:47:23 GMT 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4921 [merge]
revision-id: pqm at pqm.ubuntu.com-20091223014722-dzs9ez4fhetyixha
parent: pqm at pqm.ubuntu.com-20091223005910-zatr8ajlw8ul6d6s
parent: mbp at sourcefrog.net-20091222060726-52v6cfnsy32a9n3u
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-12-23 01:47:22 +0000
message:
(mbp) Add better example for ScriptRunner and tweak its place in the
document hierarchy
modified:
doc/developers/testing.txt testing.txt-20080812140359-i70zzh6v2z7grqex-1
=== modified file 'doc/developers/testing.txt'
--- a/doc/developers/testing.txt 2009-12-09 15:45:37 +0000
+++ b/doc/developers/testing.txt 2009-12-22 06:07:26 +0000
@@ -198,7 +198,7 @@
Shell-like tests
-~~~~~~~~~~~~~~~~
+----------------
``bzrlib/tests/script.py`` allows users to write tests in a syntax very close to a shell session,
using a restricted and limited set of commands that should be enough to mimic
@@ -287,6 +287,24 @@
$ cat file
+The actual use of ScriptRunner within a TestCase looks something like
+this::
+
+ def test_unshelve_keep(self):
+ # some setup here
+ sr = ScriptRunner()
+ sr.run_script(self, '''
+ $ bzr add file
+ $ bzr shelve --all -m Foo
+ $ bzr shelve --list
+ 1: Foo
+ $ bzr unshelve --keep
+ $ bzr shelve --list
+ 1: Foo
+ $ cat file
+ contents of file
+ ''')
+
.. Effort tests
More information about the bazaar-commits
mailing list