Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/test_workspacebuilder.py::test_pane_order does not return #377

Closed
dvzrv opened this issue Apr 19, 2018 · 23 comments
Closed

tests/test_workspacebuilder.py::test_pane_order does not return #377

dvzrv opened this issue Apr 19, 2018 · 23 comments
Assignees
Labels
bug Something isn't working

Comments

@dvzrv
Copy link

dvzrv commented Apr 19, 2018

During packaging tmuxp and after building tmuxp, I run the tests using python3 setup.py test.

However, test_workspacebuilder.py does never return (hangs forever) and I have to kill the build and build without tests (not good):

running test
Searching for pytest==3.4.2
Reading https://pypi.python.org/simple/pytest/
Downloading https://files.pythonhosted.org/packages/f1/5c/411ceafef3b5e5486d16f174db18dc26f49e7704dbf59ef488e95db47339/pytest-3.4.2-py2.py3-none-any.whl#sha256=062027955bccbc04d2fcd5d79690947e018ba31abe4c90b2c6721abec734261b
Best match: pytest 3.4.2
Processing pytest-3.4.2-py2.py3-none-any.whl
Installing pytest-3.4.2-py2.py3-none-any.whl to /build/tmuxp/src/tmuxp-1.4.0/.eggs
writing requirements to /build/tmuxp/src/tmuxp-1.4.0/.eggs/pytest-3.4.2-py3.6.egg/EGG-INFO/requires.txt

Installed /build/tmuxp/src/tmuxp-1.4.0/.eggs/pytest-3.4.2-py3.6.egg
running egg_info
writing tmuxp.egg-info/PKG-INFO
writing dependency_links to tmuxp.egg-info/dependency_links.txt
writing entry points to tmuxp.egg-info/entry_points.txt
writing requirements to tmuxp.egg-info/requires.txt
writing top-level names to tmuxp.egg-info/top_level.txt
reading manifest file 'tmuxp.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'tmuxp.egg-info/SOURCES.txt'
running build_ext
============================= test session starts ==============================
platform linux -- Python 3.6.5, pytest-3.4.2, py-1.5.3, pluggy-0.6.0
rootdir: /build/tmuxp/src/tmuxp-1.4.0, inifile: setup.cfg
plugins: rerunfailures-4.0
collected 94 items

tests/test_cli.py .......................................                [  0%]
tests/test_config.py ...............                                     [  0%]
tests/test_config_teamocil.py ........                                   [  0%]
tests/test_config_tmuxinator.py ...                                      [  0%]
tests/test_util.py .....                                                 [  0%]
tests/test_workspacebuilder.py ...s...........

Do I have to run the tests somehow differently? Am I missing something?

@rfoliva rfoliva self-assigned this Feb 12, 2019
@rfoliva
Copy link
Contributor

rfoliva commented Feb 12, 2019

This is an old one, so I wanted to confirm if it is still an issue @dvzrv .

Can you please let me know? Normally, in the project root with virtualenv activated, I just run:

$ make test

This seems to work for me and it is possibly no different than your method. But can you please let me know if you still have issue with tests, or does that help?

Thanks,
Ricardo

@dvzrv
Copy link
Author

dvzrv commented Feb 12, 2019

Yes, this is still a problem. I run py.test and currently exclude that test.

@dvzrv
Copy link
Author

dvzrv commented Feb 12, 2019

If it is of any help: I see a tmux instance/session being created after running the test, but that instance is never closed and never changes. py.test therefore never returns.

@rfoliva
Copy link
Contributor

rfoliva commented Feb 18, 2019

Hi @dvzrv,

Can you please try with v1.5.1 and let me know if problem is still there?

If so, can you please confirm OS details / arch and Python details, so I can try to reproduce this with vagrant? I believe Arch Linux, but wanted to be sure of additional details.

Thanks,
Ricardo

@dvzrv
Copy link
Author

dvzrv commented Feb 23, 2019

@rfoliva yes, unfortunately it behaves the same.

Yes, I'm packaging tmuxp for Arch.

python
Version : 3.7.2-3
python-click
Version : 7.0-1
python-colorama
Version : 0.4.1-1
python-kaptan
Version : 0.5.11-1
python-setuptools
Version : 1:40.8.0-1
python-libtmux
Version : 0.8.1-1
python-pytest
Version : 4.3.0-1
python-pytest-rerunfailures
Version : 6.0-1

@dvzrv
Copy link
Author

dvzrv commented Jun 3, 2019

This is still happening with 1.5.2. I have to Ctrl+c the tests:

============================= test session starts ==============================
platform linux -- Python 3.7.3, pytest-4.4.2, py-1.8.0, pluggy-0.11.0                      
rootdir: /build/tmuxp/src/tmuxp-1.5.2, inifile: setup.cfg
plugins: rerunfailures-7.0                                                      
collected 100 items                    
                                                                                           
tests/test_cli.py ............................................           [ 44%] 
tests/test_config.py ...........RRRRRF....                               [ 60%]            
tests/test_config_teamocil.py ........                                   [ 68%]
tests/test_config_tmuxinator.py ...                                      [ 71%]
tests/test_util.py .....                                                 [ 76%]            
tests/test_workspacebuilder.py ...s........RRRRRF..^C
                                                                                           
=================================== FAILURES ===================================
___________________________ test_expands_blank_panes ___________________________
                                                                                           
    def test_expands_blank_panes():                       
        """Expand blank config into full form.
                                                                               
        Handle ``NoneType`` and 'blank'::                 
                               
        # nothing, None, 'blank'                                     
        'panes': [                                              
            None,                        
            'blank'                                                       
        ]                                                       
                                         
        # should be blank                                                 
        'panes': [                                           
            'shell_command': []         
        ]                                                        
                                                         
        Blank strings::         
                                                                    
            panes: [                                                            
                ''                                                                         
            ]                                                                                                                                                                                                                                                                                                                                                               
                                                                                
            # should output to:                                                            
            panes:                                      
                'shell_command': ['']                                                      
                                                        
        """                                                                    
                                                                                
        yaml_config_file = os.path.join(example_dir, 'blank-panes.yaml')   
>       test_config = load_config(yaml_config_file)                                        
                                                                                           
tests/test_config.py:286:                                                                                
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _                                                                                                                                                                                                                                                                                             
tests/test_config.py:25: in load_config                                                                                                                                                                                                                                                                                                                                     
    return kaptan.Kaptan().import_config(_file).get()                                                                                                                                                                                                                                                                                                                       
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _                                                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                                                                                            
self = <kaptan.Kaptan object at 0x6545c81e3320>                                                                                                                                                                                                                                                                                                                             
value = '/build/tmuxp/src/tmuxp-1.5.2/examples/blank-panes.yaml'                                                                                                                                                                                                                                                                                                            
                                                                                           
    def import_config(self, value):                                                        
        if isinstance(value, dict):  # load python dict                         
            self.handler = self.HANDLER_MAP['dict']()                           
            data = value                                                                   
        elif os.path.isfile(value) and not self._is_python_file(value):
            if not self.handler:              
                try:     
                    key = HANDLER_EXT.get(os.path.splitext(value)[1][1:], None)
                    self.handler = self.HANDLER_MAP[key]()
                except:         
                    raise RuntimeError("Unable to determine handler")
            with open(value) as f:
                data = f.read()
        elif self._is_python_file(value):  # is a python file
            self.handler = self.HANDLER_MAP[HANDLER_EXT['py']]()
            if not value.endswith('.py'):
                value += '.py'  # in case someone is referring to a module
            data = os.path.abspath(os.path.expanduser(value))
            if not os.path.isfile(data):
                raise IOError('File {0} not found.'.format(data))
        else:                               
            if not self.handler:             
>               raise RuntimeError("Unable to determine handler")
E               RuntimeError: Unable to determine handler
                                                                                           
/usr/lib/python3.7/site-packages/kaptan/__init__.py:87: RuntimeError
____________________________ test_blank_pane_count _____________________________
                                                                                           
session = Session($1 libtmux_a82huire)            
                                                                                           
    def test_blank_pane_count(session):                          
        """:todo: Verify blank panes of various types build into workspaces."""
        yaml_config_file = os.path.join(example_dir, 'blank-panes.yaml')
>       test_config = kaptan.Kaptan().import_config(yaml_config_file).get()     
                                                                                           
tests/test_workspacebuilder.py:409:                      
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
                                                                                           
self = <kaptan.Kaptan object at 0x6545c820f7b8>                                            
value = '/build/tmuxp/src/tmuxp-1.5.2/examples/blank-panes.yaml'                
                                                                                           
    def import_config(self, value):                                            
        if isinstance(value, dict):  # load python dict                        
            self.handler = self.HANDLER_MAP['dict']()                                      
            data = value                             
        elif os.path.isfile(value) and not self._is_python_file(value):                    
            if not self.handler:                                                
                try:                                                            
                    key = HANDLER_EXT.get(os.path.splitext(value)[1][1:], None)            
                    self.handler = self.HANDLER_MAP[key]()
                except:                       
                    raise RuntimeError("Unable to determine handler")          
            with open(value) as f:                        
                data = f.read()
        elif self._is_python_file(value):  # is a python file        
            self.handler = self.HANDLER_MAP[HANDLER_EXT['py']]()
            if not value.endswith('.py'):
                value += '.py'  # in case someone is referring to a module
            data = os.path.abspath(os.path.expanduser(value))   
            if not os.path.isfile(data): 
                raise IOError('File {0} not found.'.format(data))         
        else:                                                
            if not self.handler:        
>               raise RuntimeError("Unable to determine handler")
E               RuntimeError: Unable to determine handler
                                                                                           
/usr/lib/python3.7/site-packages/kaptan/__init__.py:87: RuntimeError
=============================== warnings summary ===============================
tests/test_cli.py::test_load_workspace                                                     
  /usr/lib/python3.7/site-packages/yaml/constructor.py:126: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working                                                                                                                                                             
    if not isinstance(key, collections.Hashable):                               
                                                                                           
-- Docs: https://docs.pytest.org/en/latest/warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!           
/usr/lib/python3.7/subprocess.py:1582: KeyboardInterrupt
(to show a full traceback on KeyboardInterrupt use --fulltrace)                
==== 2 failed, 88 passed, 1 skipped, 1 warnings, 10 rerun in 172.64 seconds ====

I'm unsure whether this is what is causing the hang...
However, the file examples/blank-panes.yaml is not in the source tarball on pypi!

When using the tarball from github (which has the example files), killing the tests only leads to:

=============================== warnings summary ===============================
tests/test_cli.py::test_load_workspace
  /usr/lib/python3.7/site-packages/yaml/constructor.py:126: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
    if not isinstance(key, collections.Hashable):

-- Docs: https://docs.pytest.org/en/latest/warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/usr/lib/python3.7/subprocess.py:1476: KeyboardInterrupt
(to show a full traceback on KeyboardInterrupt use --fulltrace)
============== 90 passed, 1 skipped, 1 warnings in 65.49 seconds ===============

@tony tony closed this as completed in 11b06a4 Jun 6, 2019
@tony
Copy link
Member

tony commented Jun 6, 2019

@dvzrv v1.5.3 better?

@dvzrv
Copy link
Author

dvzrv commented Jun 6, 2019

@tony tests are now properly included in the pypi srcdist (thanks!), but tests/test_workspacebuilder.py still does not return.
I have to do py.test -k "not test_workspacebuilder" for the tests to pass.

@tony
Copy link
Member

tony commented Jun 6, 2019

@dvzrv Can you show me the test output with v1.5.3 (I think 1.5.3 would pass, if not I'm going to reopen this).

Maybe I didn't test thoroughly enough this morning (was still in the virtualenv when I ran the test now that I remember!)

@tony
Copy link
Member

tony commented Jun 9, 2019

@dvzrv I tested this with python 3 and it worked on my end

Installed /home/x/work/python/tmuxp/dist/tmuxp-1.5.3/.eggs/zipp-0.5.1-py3.7.egg
running egg_info
writing tmuxp.egg-info/PKG-INFO
writing dependency_links to tmuxp.egg-info/dependency_links.txt
writing entry points to tmuxp.egg-info/entry_points.txt
writing requirements to tmuxp.egg-info/requires.txt
writing top-level names to tmuxp.egg-info/top_level.txt
reading manifest file 'tmuxp.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.json' under directory 'tests'
writing manifest file 'tmuxp.egg-info/SOURCES.txt'
running build_ext
==================================================================================================================== test session starts =====================================================================================================================
platform linux -- Python 3.7.3, pytest-4.6.2, py-1.8.0, pluggy-0.12.0
rootdir: /home/x/work/python/tmuxp/dist/tmuxp-1.5.3, inifile: setup.cfg
plugins: rerunfailures-7.0
collected 100 items                                                                                                                                                                                                                                          

tests/test_cli.py ............................................                                                                                                                                                                                         [ 44%]
tests/test_config.py ................                                                                                                                                                                                                                  [ 60%]
tests/test_config_teamocil.py ........                                                                                                                                                                                                                 [ 68%]
tests/test_config_tmuxinator.py ...                                                                                                                                                                                                                    [ 71%]
tests/test_util.py .....                                                                                                                                                                                                                               [ 76%]
tests/test_workspacebuilder.py ...s.................                                                                                                                                                                                                   [ 97%]
tests/test_workspacefreezer.py .                                                                                                                                                                                                                       [ 98%]
tests/tests/test_helpers.py ..                                                                                                                                                                                                                         [100%]

============================================================================================================ 99 passed, 1 skipped in 9.07 seconds ============================================================================================================

Can you give it another try?

I think that the workspacebuilder issue is fixed by 1.5.3 including the missing file.

The retry issue would be fixed by --reruns 0 to pytest.

Any better now?

@dvzrv
Copy link
Author

dvzrv commented Jun 9, 2019

I'm still at the same result with 1.5.3:

============================= test session starts ==============================
platform linux -- Python 3.7.3, pytest-4.4.2, py-1.8.0, pluggy-0.11.0
rootdir: /build/tmuxp/src/tmuxp-1.5.3, inifile: setup.cfg
plugins: rerunfailures-7.0
collected 100 items

tests/test_cli.py ............................................           [ 44%]
tests/test_config.py ................                                    [ 60%]
tests/test_config_teamocil.py ........                                   [ 68%]
tests/test_config_tmuxinator.py ...                                      [ 71%]
tests/test_util.py .....                                                 [ 76%]
tests/test_workspacebuilder.py ...s...........^C

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/usr/lib/python3.7/subprocess.py:1582: KeyboardInterrupt
(to show a full traceback on KeyboardInterrupt use --fulltrace)
==================== 90 passed, 1 skipped in 831.74 seconds ====================

The difference between starting the packaging process locally
tmuxp-makepkg

and in a Linux container
tmuxp-devtools

is, that in the latter case, a separate tmux session is actually spawned on which test_workspacebuilder.py seems to work on.

In both cases, the test session never returns though!

@tony
Copy link
Member

tony commented Jun 9, 2019

@dvzrv Can you pass -vvv to pytest to see which one is hanging?

Thank you for this info?

@dvzrv
Copy link
Author

dvzrv commented Jun 9, 2019

tests/test_workspacebuilder.py::test_pane_order seems to be the culprit!

tmuxp-1.5.3-2-x86_64-check.log

@tony
Copy link
Member

tony commented Jun 9, 2019

@dvzrv Nice find! Looking into it now

tmux -V ?

@dvzrv
Copy link
Author

dvzrv commented Jun 9, 2019

It's tmux 2.9a, but it has been like this since at least tmux 2.7 (when cross checking the update log of the package).

@dvzrv
Copy link
Author

dvzrv commented Jun 9, 2019

Also, man, sorry, could've provided -vvv much earlier. Sometimes reporting bugs is happening in some sort of autopilot ;-)

@tony
Copy link
Member

tony commented Jun 9, 2019

You can change it to ignore just tests/test_workspacebuilder.py::test_pane_order for now

Looking into the assertion now (my difficulty is I'm having trouble reproducing it, so I am reading it carefully to make sure I didn't write any flaky assertions/setup)

No issue at all!

@dvzrv
Copy link
Author

dvzrv commented Jun 9, 2019

Cool, thank you!
As a side note: That seems to be the only test, that is failing in the build process! Will change the title of this issue.

@dvzrv dvzrv changed the title tests/test_workspacebuilder.py does not return tests/test_workspacebuilder.py::test_pane_order does not return Jun 9, 2019
@tony
Copy link
Member

tony commented Jun 9, 2019

@dvzrv Thank you!

@tony tony reopened this Jun 9, 2019
@tony
Copy link
Member

tony commented Jun 9, 2019

Also reopening

@joseph-flinn joseph-flinn added the bug Something isn't working label Jan 18, 2021
@dvzrv
Copy link
Author

dvzrv commented Jun 15, 2021

Just as a heads up: This issue is still present on 1.8.1

@dvzrv
Copy link
Author

dvzrv commented Aug 1, 2022

This issue seems to be gone with 1.12.0

@dvzrv dvzrv closed this as completed Aug 1, 2022
@tony
Copy link
Member

tony commented Aug 1, 2022

@dvzrv Thank you for getting back on this!

@categulario Good job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants