Rev 4676: Create a new test case based on TestCaseWithMemoryTransport. in file:///home/vila/src/bzr/experimental/shell-like-tests/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Thu Sep 3 16:49:05 BST 2009
At file:///home/vila/src/bzr/experimental/shell-like-tests/
------------------------------------------------------------
revno: 4676
revision-id: v.ladeuil+lp at free.fr-20090903154905-g9kudjm7noikwmyb
parent: v.ladeuil+lp at free.fr-20090903152408-6z86c4vcol338i5h
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: shell-like-tests
timestamp: Thu 2009-09-03 17:49:05 +0200
message:
Create a new test case based on TestCaseWithMemoryTransport.
* bzrlib/tests/script.py:
(TestCaseWithMemoryTransportAndScript): Start a test case based on
memory transport.... and realize almost all commands can't use
it (yet).
-------------- next part --------------
=== modified file 'bzrlib/tests/script.py'
--- a/bzrlib/tests/script.py 2009-09-03 15:24:08 +0000
+++ b/bzrlib/tests/script.py 2009-09-03 15:49:05 +0000
@@ -303,6 +303,26 @@
return None, None
+class TestCaseWithMemoryTransportAndScript(tests.TestCaseWithMemoryTransport):
+
+ def setUp(self):
+ super(TestCaseWithMemoryTransportAndScript, self).setUp()
+ self.script_runner = ScriptRunner(self)
+ # Break the circular dependency
+ def break_dependency():
+ self.script_runner = None
+ self.addCleanup(break_dependency)
+
+ def get_jail_root(self):
+ raise NotImplementedError(self.get_jail_root)
+
+ def run_script(self, script):
+ return self.script_runner.run_script(script)
+
+ def run_command(self, cmd, input, output, error):
+ return self.script_runner.run_command(cmd, input, output, error)
+
+
class TestCaseWithTransportAndScript(tests.TestCaseWithTransport):
def setUp(self):
=== modified file 'bzrlib/tests/test_script.py'
--- a/bzrlib/tests/test_script.py 2009-09-03 15:24:08 +0000
+++ b/bzrlib/tests/test_script.py 2009-09-03 15:49:05 +0000
@@ -83,12 +83,7 @@
script._script_to_commands(story))
-class TestScriptBase(script.TestCaseWithTransportAndScript):
-
- pass
-
-
-class TestScriptExecution(TestScriptBase):
+class TestScriptExecution(script.TestCaseWithTransportAndScript):
def test_unknown_command(self):
self.assertRaises(SyntaxError, self.run_script, 'foo')
@@ -102,7 +97,7 @@
self.assertRaises(AssertionError, self.run_script, story)
-class TestCat(TestScriptBase):
+class TestCat(script.TestCaseWithTransportAndScript):
def test_cat_usage(self):
self.assertRaises(SyntaxError, self.run_script, 'cat foo bar baz')
@@ -135,7 +130,7 @@
self.assertFileEqual('content\n', 'file2')
-class TestMkdir(TestScriptBase):
+class TestMkdir(script.TestCaseWithTransportAndScript):
def test_mkdir_usage(self):
self.assertRaises(SyntaxError, self.run_script, 'mkdir')
@@ -156,7 +151,7 @@
self.failUnlessExists('dir2')
-class TestCd(TestScriptBase):
+class TestCd(script.TestCaseWithTransportAndScript):
def test_cd_usage(self):
self.assertRaises(SyntaxError, self.run_script, 'cd foo bar')
@@ -178,14 +173,14 @@
self.assertEquals(self.test_dir, osutils.getcwd())
-class TestBzr(TestScriptBase):
+class TestBzr(script.TestCaseWithTransportAndScript):
def test_bzr_smoke(self):
self.run_script('bzr init branch')
self.failUnlessExists('branch')
-class TestEcho(TestScriptBase):
+class TestEcho(script.TestCaseWithMemoryTransportAndScript):
def test_echo_usage(self):
story = """
More information about the bazaar-commits
mailing list