From 3e34086b8ebf8166663339413495bbf4df75c24e Mon Sep 17 00:00:00 2001 From: Holger Rapp Date: Sun, 5 Jul 2009 00:53:30 +0200 Subject: [PATCH] Made test execution faster and also a bit more reliable. The remaining problem is the screen stuff command :/ --- test.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test.py b/test.py index fdc00b1..5516735 100755 --- a/test.py +++ b/test.py @@ -21,7 +21,7 @@ def type(str, session): class _VimTest(unittest.TestCase): text_before = " --- some text before --- " text_after = " --- some text after --- " - + def send(self,s): send(s, self.session) @@ -75,15 +75,19 @@ EOF handle, fn = tempfile.mkstemp(prefix="PySnipEmuTest",suffix=".txt") os.close(handle) + os.unlink(fn) self.escape() self.send(":w! %s\n" % fn) - # Give screen a chance to send the cmd and vim to write the file - time.sleep(.25) - # Read the output, chop the trailing newline - self.output = open(fn,"r").read()[:-1] + tries = 50 + while tries: + if os.path.exists(fn): + self.output = open(fn,"r").read()[:-1] + break + time.sleep(.05) + tries -= 1 def cmd(self): @@ -598,7 +602,7 @@ class Transformation_OptionReplaceGlobalMatchInReplace_ECR(_VimTest): # TODO: conditional in conditional, case folding recursive # TODO: jumping out of snippet in insert mode -# +# print "TODO: backspacing when tab is selected" ###################