Commit 0fad9a6d authored by Xavier Thompson's avatar Xavier Thompson

software/slapos-testing: Quickfix python -E errors

Since upgrading to zc.buildout = 3.0.1+slapos004, slapos.rebootstrap
and slapos.recipe.template tests are failing due to: these two tests
running buildout, buildout installing develop eggs, develop eggs now
being installed with pip install -e instead of setup.py develop, and
pip install -e launching sys.executable -E at some point. This fails
because the tests are run using gpython:main script, which currently
does not support -E option.

As a quick fix run these two tests with a barebone python executable
and use export PYTHONPATH to provide the needed eggs. This is not as
good as gpython:main because PYTHONPATH will be inherited by all sub
processes and not just those launched with sys.executable, including
potentially other versions of python.
parent 76fe99d6
...@@ -15,4 +15,4 @@ ...@@ -15,4 +15,4 @@
[template] [template]
filename = instance.cfg filename = instance.cfg
md5sum = 5f5378550470b551d280dd432878a0ba md5sum = 9493b2789de783c375920eec74252499
...@@ -102,6 +102,17 @@ template = inline:#!/bin/sh ...@@ -102,6 +102,17 @@ template = inline:#!/bin/sh
python -m unittest discover -v python -m unittest discover -v
rendered = $${re6stnet:location}/test-runner.sh rendered = $${re6stnet:location}/test-runner.sh
# XXX: Quick fix for tests failing due to python -E unknown option.
# When gpython:main supports -E, move back to using that instead.
[real-python-with-eggs]
recipe = slapos.recipe.template
inline =
#!/bin/sh
export PYTHONPATH=$(python -c "import sys; print(':'.join(p for p in sys.path if p))")
python=$(python -c "import sys; print(sys._gpy_underlying_executable)")
exec $python "$@"
output = $${buildout:bin-directory}/$${:_buildout_section_name_}
[slapos-test-runner-nxdtest-environment.sh] [slapos-test-runner-nxdtest-environment.sh]
recipe = slapos.recipe.template recipe = slapos.recipe.template
output = $${create-directory:etc}/$${:_buildout_section_name_} output = $${create-directory:etc}/$${:_buildout_section_name_}
...@@ -171,9 +182,9 @@ inline = ...@@ -171,9 +182,9 @@ inline =
) )
TestCase( TestCase(
"slapos.recipe.template", "slapos.recipe.template",
# ['python', '-m', 'unittest', 'slapos.recipe.template.tests.test_suite'], # ['$${real-python-with-eggs:output}', '-m', 'unittest', 'slapos.recipe.template.tests.test_suite'],
# XXX some test fail when running with unittest, so we keep using setup.py test # XXX some test fail when running with unittest, so we keep using setup.py test
['python', 'setup.py', 'test'], ['$${real-python-with-eggs:output}', 'setup.py', 'test'],
cwd="""$${slapos.recipe.template:location}""", cwd="""$${slapos.recipe.template:location}""",
summaryf=UnitTest.summary, summaryf=UnitTest.summary,
) )
...@@ -205,7 +216,7 @@ inline = ...@@ -205,7 +216,7 @@ inline =
) )
TestCase( TestCase(
"slapos.rebootstrap", "slapos.rebootstrap",
['python', '-m', 'unittest', '-v', 'slapos.rebootstrap.tests.test_suite'], ['$${real-python-with-eggs:output}', '-m', 'unittest', '-v', 'slapos.rebootstrap.tests.test_suite'],
cwd="""$${slapos.rebootstrap:location}""", cwd="""$${slapos.rebootstrap:location}""",
summaryf=UnitTest.summary, summaryf=UnitTest.summary,
) )
......
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