[Checkins] SVN: z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.txt Fix tests for windows and other OSes with and without virtualenv.

Jan-Jaap Driessen jdriessen at thehealthagency.com
Thu Dec 16 17:52:05 EST 2010


Log message for revision 118976:
  Fix tests for windows and other OSes with and without virtualenv.

Changed:
  U   z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.txt

-=-
Modified: z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.txt
===================================================================
--- z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.txt	2010-12-16 22:50:28 UTC (rev 118975)
+++ z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.txt	2010-12-16 22:52:04 UTC (rev 118976)
@@ -11,22 +11,22 @@
 
     >>> import os, sys
 
-    >>> ok_script = ok_path = os.path.join(sample_buildout, 'test-ok')
-    >>> failure_script = failure_path = os.path.join(sample_buildout, 'test-failure')
-    >>> if sys.platform.startswith('win'):
-    ...     ok_path += '-script.py'
-    ...     failure_path += '-script.py'
-
-    >>> write(ok_path, """
+    >>> # Re-use zc.buildout internals in order to handle both windows
+    >>> # and other environments.
+    >>> from zc.buildout.easy_install import _write_script
+    >>> ok_script = os.path.join(sample_buildout, 'test-ok')
+    >>> _ = _write_script(ok_script, '''\
+    ... #!%s
     ... import time
     ... time.sleep(1)
-    ... print 'ok'
-    ... """)
-    >>> write(failure_path, """
+    ... print 'ok' ''' % sys.executable, 'script')
+
+    >>> failure_script = os.path.join(sample_buildout, 'test-failure')
+    >>> _ = _write_script(failure_script, '''\
+    ... #!%s
     ... import time
     ... time.sleep(1)
-    ... raise SystemError('Fail!')
-    ... """)
+    ... raise SystemError('Fail!') ''' % sys.executable, 'script')
 
     >>> from z3c.recipe.compattest.runner import main
     >>> main(1, ok_script, failure_script, no_exit_code=True)



More information about the checkins mailing list