neovim / pynvim

Python client and plugin host for Nvim
http://pynvim.readthedocs.io/en/latest/
Apache License 2.0
1.48k stars 118 forks source link

Test suite hangs on OpenBSD #452

Closed vext01 closed 3 years ago

vext01 commented 3 years ago

Version 0.4.1:

cd /usr/local/pobj/py-neovim-0.4.1-python3/pynvim-0.4.1 && /usr/local/bin/py.test-3
============================= test session starts ==============================
platform openbsd6 -- Python 3.8.5, pytest-4.4.0, py-1.8.0, pluggy-0.11.0
rootdir: /usr/local/pobj/py-neovim-0.4.1-python3/pynvim-0.4.1, inifile: setup.cfg, testpaths: test
collected 68 items

test/test_buffer.py F

And then it hangs... Python sits idle. Deadlock?

If I add -x, we see the failing test is:

__________________________________ test_repr ___________________________________

vim = <pynvim.api.nvim.Nvim object at 0xfa5780da490>

    def test_repr(vim):
>       assert repr(vim.current.buffer) == "<Buffer(handle=1)>"
E       AssertionError: assert '<Buffer(handle=2)>' == '<Buffer(handle=1)>'
E         - <Buffer(handle=2)>
E         ?                ^
E         + <Buffer(handle=1)>
E         ?                ^

test/test_buffer.py:10: AssertionError
=========================== 1 failed in 0.21 seconds ===========================

Which looks a lot like #416 ?

Any ideas?

vext01 commented 3 years ago

The hang is due to $HOME being set to /nonexistent in the ports tree. So our fault, not yours.

After fixing that, we have failures that look a lot like #416. Will update #416.

ysolis commented 3 years ago

I have the same error. I am with Archlinux, the problem happens in the same scenario

❯ python2 setup.py pytest
running pytest
running egg_info
writing requirements to pynvim.egg-info/requires.txt
writing pynvim.egg-info/PKG-INFO
writing top-level names to pynvim.egg-info/top_level.txt
writing dependency_links to pynvim.egg-info/dependency_links.txt
reading manifest file 'pynvim.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pynvim.egg-info/SOURCES.txt'
running build_ext
====================================================================== test session starts ======================================================================
platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.9.0, pluggy-0.13.1
rootdir: /home/yonsy/devops/hacks/pynvim, inifile: setup.cfg, testpaths: test
collected 69 items                                                                                                                                              

test/test_buffer.py .

In my case, the difference is that i changed the hostname (is my personal laptop) before install neovim and pynvim plugin

i changed the hostname with hostnamectl command, and change in /etc/hosts and /etc/hostname too

if i kill the python2 executable running the test (several times) i get this:

collected 69 items                                                                                                                                                                                                                                                               

test/test_buffer.py .FFF.F..F.FFF.FF.                                                                                                                     [ 24%]
test/test_client_rpc.py ....                                                                                                                              [ 30%]
test/test_concurrency.py ..                                                                                                                               [ 33%]
test/test_decorators.py .                                                                                                                                 [ 34%]
test/test_events.py ....                                                                                                                                  [ 40%]
test/test_host.py ...                                                                                                                                     [ 44%]
test/test_logging.py .                                                                                                                                    [ 46%]
test/test_tabpage.py .....                                                                                                                                [ 53%]
test/test_vim.py .F.......

and in another shell:

❯ ps -eafl | grep nvim
0 S yonsy    2520301 2520294  0  90   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2520302 2520294  0  85   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2520601 2520294  0  85   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2520618 2520294  0  85   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2520636 2520294  0  80   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2520637 2520294  0  81   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2520872 2520294  0  80   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2520873 2520294  0  85   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2520874 2520294  0  83   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2520891 2520294  0  85   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2520892 2520294  0  85   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2520899 2520294  0  88   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2520914 2520294  0  89   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2520931 2520294  0  88   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2520932 2520294  0  87   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2520949 2520294  0  86   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521202 2520294  0  88   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521203 2520294  0  88   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521204 2520294  0  85   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521205 2520294  0  85   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521207 2520294  0  80   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521208 2520294  0  88   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521218 2520294  0  87   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521220 2520294  0  84   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521221 2520294  0  86   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521222 2520294  0  87   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521225 2520294  0  80   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521232 2520294  0  87   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521233 2520294  0  86   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521235 2520294  0  84   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521237 2520294  0  80   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521238 2520294  0  80   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521239 2520294  0  83   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521240 2520294  0  80   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521241 2520294  0  87   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521242 2520294  0  88   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521243 2520294  0  86   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521244 2520294  0  90   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521245 2520294  0  88   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521246 2520294  0  85   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521247 2520294  0  86   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521248 2520294  0  85   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521249 2520294  0  85   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521250 2520294  0  83   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2521251 2520294  0  85   0 -  3620 -      19:31 pts/2    00:00:00 nvim -u NONE --embed --headless
0 S yonsy    2525627 2256617  0  80   0 -  1599 -      19:33 pts/5    00:00:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox nvim   

appears several nvim headless, instead of being reused.

blueyed commented 3 years ago

@vext01 try running pytest with -s and/or -x, to get more/some info.

ysolis commented 3 years ago
❯ pytest2 -x
============================================================================================================================== test session starts ===============================================================================================================================
platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.9.0, pluggy-0.13.1
rootdir: /home/yonsy/devops/hacks/pynvim, inifile: setup.cfg, testpaths: test
collected 69 items                                                                                                                                                                                                                                                               

test/test_buffer.py .^CF

==================================================================================================================================== FAILURES ====================================================================================================================================
________________________________________________________________________________________________________________________________ test_get_length _________________________________________________________________________________________________________________________________

vim = <pynvim.api.nvim.Nvim object at 0x7f876afa7410>

    def test_get_length(vim):
        assert len(vim.current.buffer) == 1
>       vim.current.buffer.append('line')

test/test_buffer.py:15: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python2.7/site-packages/pynvim/api/buffer.py:97: in append
    return self.request('nvim_buf_set_lines', index, index, True, lines)
../../../.local/lib/python2.7/site-packages/pynvim/api/common.py:58: in request
    return self._session.request(name, self, *args, **kwargs)
../../../.local/lib/python2.7/site-packages/pynvim/api/nvim.py:182: in request
    res = self._session.request(name, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pynvim.msgpack_rpc.session.Session object at 0x7f876af617d0>, method = 'nvim_buf_set_lines', args = (ExtType(code=0, data='\x01'), -1, -1, True, ['line']), kwargs = {}, async_ = False, v = []

    def request(self, method, *args, **kwargs):
        """Send a msgpack-rpc request and block until as response is received.

        If the event loop is running, this method must have been called by a
        request or notification handler running on a greenlet. In that case,
        send the quest and yield to the parent greenlet until a response is
        available.

        When the event loop is not running, it will perform a blocking request
        like this:
        - Send the request
        - Run the loop until the response is available
        - Put requests/notifications received while waiting into a queue

        If the `async_` flag is present and True, a asynchronous notification
        is sent instead. This will never block, and the return value or error
        is ignored.
        """
        async_ = check_async(kwargs.pop('async_', None), kwargs, False)
        if async_:
            self._async_session.notify(method, args)
            return

        if kwargs:
            raise ValueError("request got unsupported keyword argument(s): {}"
                             .format(', '.join(kwargs.keys())))

        if self._is_running:
            v = self._yielding_request(method, args)
        else:
            v = self._blocking_request(method, args)
        if not v:
            # EOF
>           raise OSError('EOF')
E           OSError: EOF

../../../.local/lib/python2.7/site-packages/pynvim/msgpack_rpc/session.py:98: OSError
======================================================================================================================= 1 failed, 1 passed in 0.63 seconds =======================================================================================================================