Commit a188caa4 authored by Jérome Perrin's avatar Jérome Perrin

tests: use print function for python3 compatibility

and add the <BLANKLINES> where needed.
parent 2420e816
......@@ -38,8 +38,9 @@ TODO: The test is incomplete for 2 reasons:
... def __getattr__(self, attr):
... return getattr(sys, attr)
... """)
>>> print system(buildout),
>>> print(system(buildout))
Develop: '/sample-buildout/recipes'
<BLANKLINE>
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
......@@ -57,7 +58,7 @@ Develop: '/sample-buildout/recipes'
... recipe = recipes:pyshow
... """ % dict(syspython=sys.executable))
>>> print system(buildout), # doctest: +ELLIPSIS
>>> print(system(buildout)) # doctest: +ELLIPSIS
slapos.rebootstrap: Make sure that the section 'installpython' won't be reinstalled after rebootstrap.
Develop: '/sample-buildout/recipes'
Installing installpython.
......@@ -73,3 +74,4 @@ Buildout will be restarted automatically to have this change applied.
While:
Installing.
Error: Couldn't find a distribution for 'setuptools==...'
<BLANKLINE>
......@@ -2,8 +2,9 @@ Simple case: switch to a Python with same major/minor version
-------------------------------------------------------------
>>> import sys
>>> print system(buildout),
>>> print(system(buildout))
Develop: '/sample-buildout/recipes'
<BLANKLINE>
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
......@@ -21,7 +22,7 @@ Develop: '/sample-buildout/recipes'
... recipe = recipes:pyshow
... """ % dict(syspython=sys.executable))
>>> print system(buildout),
>>> print(system(buildout))
slapos.rebootstrap: Make sure that the section 'installpython' won't be reinstalled after rebootstrap.
Develop: '/sample-buildout/recipes'
Installing installpython.
......@@ -39,15 +40,17 @@ Develop: '/sample-buildout/recipes'
Updating installpython.
Installing realrun.
Running with: /sample_buildout/parts/installpython/bin/python
<BLANKLINE>
>>> print system(buildout),
>>> print(system(buildout))
Develop: '/sample-buildout/recipes'
Updating installpython.
Updating realrun.
Running with: /sample_buildout/parts/installpython/bin/python
<BLANKLINE>
>>> cp(buildout + '-orig', buildout)
>>> print system(buildout),
>>> print(system(buildout))
slapos.rebootstrap: Make sure that the section 'installpython' won't be reinstalled after rebootstrap.
Develop: '/sample-buildout/recipes'
Updating installpython.
......@@ -64,3 +67,4 @@ Develop: '/sample-buildout/recipes'
Updating installpython.
Updating realrun.
Running with: /sample_buildout/parts/installpython/bin/python
<BLANKLINE>
......@@ -3,8 +3,9 @@
An edge case is when the python is provided by a part that does not need to install anything.
>>> import sys
>>> print system(buildout),
>>> print(system(buildout))
Develop: '/sample-buildout/recipes'
<BLANKLINE>
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
......@@ -22,9 +23,10 @@ Develop: '/sample-buildout/recipes'
... recipe = recipes:pyshow
... """ % dict(syspython=sys.executable))
>>> print system(buildout),
>>> print(system(buildout))
Using already installed /system_python
Develop: '/sample-buildout/recipes'
Installing already_installed_python.
Installing realrun.
Running with: /system_python
<BLANKLINE>
......@@ -59,12 +59,13 @@ class Pyinstall:
update = install
""")
write(sample_buildout, 'recipes', 'pyalreadyinstalled.py', """
from __future__ import print_function
import os, zc.buildout, shutil, sys
class PyAlreadyInstalled:
def __init__(self, buildout, name, options):
print "Using already installed", sys.executable
print("Using already installed", sys.executable)
options['executable'] = sys.executable
def install(self):
......@@ -73,6 +74,7 @@ class PyAlreadyInstalled:
update = install
""")
write(sample_buildout, 'recipes', 'pyshow.py', """
from __future__ import print_function
import os, zc.buildout, shutil, sys
class Pyshow:
......@@ -81,7 +83,7 @@ class Pyshow:
pass
def install(self):
print 'Running with:', sys.executable
print('Running with:', sys.executable)
return []
update = install
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment