-
Kirill Smelkov authored
This test was failing when pygolang was not dev-mode installed (`pip install -e .`): kirr@deco:~/src/tools/go/pygolang$ py.test =========================================== test session starts ============================================ platform linux2 -- Python 2.7.15+, pytest-3.6.4, py-1.6.0, pluggy-0.6.0 rootdir: /home/kirr/src/tools/go/pygolang, inifile: collected 8 items golang/_gopath_test.py .. [ 25%] golang/gcompat_test.py . [ 37%] golang/golang_test.py F.... [100%] ================================================= FAILURES ================================================= _________________________________________________ test_go __________________________________________________ def test_go(): # leaked goroutine behaviour check: done in separate process because we need # to test process termination exit there. subprocess.check_call([sys.executable, > dirname(__file__) + "/golang_test_goleaked.py"]) golang/golang_test.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ popenargs = (['/usr/bin/python2', '/home/kirr/src/tools/go/pygolang/golang/golang_test_goleaked.py'],) kwargs = {}, retcode = 1 cmd = ['/usr/bin/python2', '/home/kirr/src/tools/go/pygolang/golang/golang_test_goleaked.py'] def check_call(*popenargs, **kwargs): """Run command with arguments. Wait for command to complete. If the exit code was zero then return, otherwise raise CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute. The arguments are the same as for the Popen constructor. Example: check_call(["ls", "-l"]) """ retcode = call(*popenargs, **kwargs) if retcode: cmd = kwargs.get("args") if cmd is None: cmd = popenargs[0] > raise CalledProcessError(retcode, cmd) E CalledProcessError: Command '['/usr/bin/python2', '/home/kirr/src/tools/go/pygolang/golang/golang_test_goleaked.py']' returned non-zero exit status 1 /usr/lib/python2.7/subprocess.py:190: CalledProcessError ------------------------------------------- Captured stderr call ------------------------------------------- Traceback (most recent call last): File "/home/kirr/src/tools/go/pygolang/golang/golang_test_goleaked.py", line 23, in <module> from golang import go, chan ImportError: No module named golang ==================================== 1 failed, 7 passed in 0.10 seconds ==================================== Fix it by injecting top-level pygolang/ into $PYTHONPATH when testing via external processes. Fixes 69cef96e (go: Don't allow leaked goroutines to prevent program to exit)
ec929991