Commit f15459b9 authored by Kirill Smelkov's avatar Kirill Smelkov

gpython: tests: Skip test_pymain_run_via_relpath on SlapOS

Similarly to test_pymain_syspath we cannot run this test on SlapOS because with
buildout raw underlying python interpreter does not have access to eggs with
which gpython script was generated.

See 0fa9d6e7 and 92bb5bcc for details.

Without this patch running pygolang tests fails on SlapOS as shown below:

    (pygolang-env) slapuser34@vifibcloud-rapidspace-hosting-007:~/srv/runner/software/44fe7dd3f13ecd100894c6368a35c055/parts/pygolang-dev$ gpython -m pytest -vsx -k relpath
    ================================================= test session starts ==================================================
    platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.9.0, pluggy-0.13.1 -- /srv/slapgrid/slappart34/srv/runner/software/44fe7dd3f13ecd100894c6368a35c055/bin/gpython
    cachedir: .pytest_cache
    rootdir: /srv/slapgrid/slappart34/srv/runner/software/44fe7dd3f13ecd100894c6368a35c055/parts/pygolang-dev
    collected 115 items / 114 deselected / 1 selected

    gpython/gpython_test.py::test_pymain_run_via_relpath Traceback (most recent call last):
      File "./__init__.py", line 511, in <module>
        main()
      File "./__init__.py", line 395, in main
        pymain(argv, init)
      File "./__init__.py", line 217, in pymain
        init()
      File "./__init__.py", line 364, in init
        import gevent
    ImportError: No module named gevent
    FAILED

    ======================================================= FAILURES =======================================================
    _____________________________________________ test_pymain_run_via_relpath ______________________________________________

        @gpython_only
        def test_pymain_run_via_relpath():
            argv = ['-c',  'import sys; print(sys.version)']
            out1 = pyout(                    argv, pyexe=sys.executable)
    >       out2 = pyout(['./__init__.py'] + argv, pyexe=sys._gpy_underlying_executable, cwd=here)

    gpython/gpython_test.py:301:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    golang/golang_test.py:1842: in pyout
        return pyrun(argv, stdin=stdin, stdout=stdout, stderr=stderr, **kw)
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    argv = ['./__init__.py', '-c', 'import sys; print(sys.version)'], stdin = None, stdout = '', stderr = None
    kw = {'cwd': '/srv/slapgrid/slappart34/srv/runner/software/44fe7dd3f13ecd100894c6368a35c055/parts/pygolang-dev/gpython', 'pyexe': '/srv/slapgrid/slappart34/srv//runner//shared/python2.7/44578f5389723084b136574c34bc8023/bin/python2.7'}
    retcode = 1

        def pyrun(argv, stdin=None, stdout=None, stderr=None, **kw):
            retcode, stdout, stderr = _pyrun(argv, stdin=stdin, stdout=stdout, stderr=stderr, **kw)
            if retcode:
    >           raise RuntimeError(' '.join(argv) + '\n' + (stderr and str(stderr) or '(failed)'))
    E           RuntimeError: ./__init__.py -c import sys; print(sys.version)
    E           (failed)

    golang/golang_test.py:1836: RuntimeError
    ======================================= 1 failed, 114 deselected in 0.73 seconds =======================================

Fixes 076cdd8f (gpython: Fix crash when invoked as e.g. ./bin/gpython).

/reviewed-on !11
parent 1cdb721d
...@@ -296,6 +296,10 @@ def test_pymain_ver(runtime): ...@@ -296,6 +296,10 @@ def test_pymain_ver(runtime):
# verify that ./bin/gpython runs ok. # verify that ./bin/gpython runs ok.
@gpython_only @gpython_only
def test_pymain_run_via_relpath(): def test_pymain_run_via_relpath():
from gpython import _is_buildout_script
if _is_buildout_script(sys.executable):
pytest.xfail("with buildout raw underlying interpreter does not have " +
"access to installed eggs")
argv = ['-c', 'import sys; print(sys.version)'] argv = ['-c', 'import sys; print(sys.version)']
out1 = pyout( argv, pyexe=sys.executable) out1 = pyout( argv, pyexe=sys.executable)
out2 = pyout(['./__init__.py'] + argv, pyexe=sys._gpy_underlying_executable, cwd=here) out2 = pyout(['./__init__.py'] + argv, pyexe=sys._gpy_underlying_executable, cwd=here)
......
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