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