Skip to content

Commit

Permalink
Fix tests for windows and other OSes with and without virtualenv.
Browse files Browse the repository at this point in the history
  • Loading branch information
janjaapdriessen committed Dec 16, 2010
1 parent bf1265d commit d23f5f4
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/z3c/recipe/compattest/runner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ failures.

>>> 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)
Expand Down

0 comments on commit d23f5f4

Please sign in to comment.