fury icon indicating copy to clipboard operation
fury copied to clipboard

Strange behavior in Linux only machines concerning event_recording and testing

Open Garyfallidis opened this issue 6 years ago • 4 comments

Description

Some tests fail in Linux and pass in Windows and Mac. Unexpected. Tests pass in Travis too with virtualgl and mesa.

Here are the reported failures in Ubuntu 18.04 64 with Nvidia GeForce GTX 1070 GPU.

=================================== FAILURES ===================================
_____________________________ test_ui_button_panel _____________________________

args = (), kwargs = {}

    def test_with_xvfb(*args, **kwargs):
        if use_xvfb:
            from xvfbwrapper import Xvfb
            display = Xvfb(width=1920, height=1080)
            display.start()
>       my_test(*args, **kwargs)

anaconda3/lib/python3.7/site-packages/fury/decorators.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:273: in test_ui_button_panel
    event_counter.check_counts(expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <fury.tests.test_ui.EventCounter object at 0x7fb239b06ba8>
expected = <fury.tests.test_ui.EventCounter object at 0x7fb239b064e0>

    def check_counts(self, expected):
        npt.assert_equal(len(self.events_counts),
                         len(expected.events_counts))
    
        # Useful loop for debugging.
        msg = "{}: {} vs. {} (expected)"
        for event, count in expected.events_counts.items():
            if self.events_counts[event] != count:
                print(msg.format(event, self.events_counts[event], count))
    
        msg = "Wrong count for '{}'."
        for event, count in expected.events_counts.items():
            npt.assert_equal(self.events_counts[event], count,
>                            err_msg=msg.format(event))
E           AssertionError: 
E           Items are not equal: Wrong count for 'RightButtonReleaseEvent'.
E            ACTUAL: 0
E            DESIRED: 3

anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:75: AssertionError
_______________________________ test_ui_textbox ________________________________

args = (), kwargs = {}

    def test_with_xvfb(*args, **kwargs):
        if use_xvfb:
            from xvfbwrapper import Xvfb
            display = Xvfb(width=1920, height=1080)
            display.start()
>       my_test(*args, **kwargs)

anaconda3/lib/python3.7/site-packages/fury/decorators.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:305: in test_ui_textbox
    event_counter.check_counts(expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <fury.tests.test_ui.EventCounter object at 0x7fb239a87470>
expected = <fury.tests.test_ui.EventCounter object at 0x7fb239a87518>

    def check_counts(self, expected):
        npt.assert_equal(len(self.events_counts),
                         len(expected.events_counts))
    
        # Useful loop for debugging.
        msg = "{}: {} vs. {} (expected)"
        for event, count in expected.events_counts.items():
            if self.events_counts[event] != count:
                print(msg.format(event, self.events_counts[event], count))
    
        msg = "Wrong count for '{}'."
        for event, count in expected.events_counts.items():
            npt.assert_equal(self.events_counts[event], count,
>                            err_msg=msg.format(event))
E           AssertionError: 
E           Items are not equal: Wrong count for 'KeyPressEvent'.
E            ACTUAL: 0
E            DESIRED: 62

anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:75: AssertionError
____________________________ test_ui_ring_slider_2d ____________________________

args = (), kwargs = {}

    def test_with_xvfb(*args, **kwargs):
        if use_xvfb:
            from xvfbwrapper import Xvfb
            display = Xvfb(width=1920, height=1080)
            display.start()
>       my_test(*args, **kwargs)

anaconda3/lib/python3.7/site-packages/fury/decorators.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:518: in test_ui_ring_slider_2d
    event_counter.check_counts(expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <fury.tests.test_ui.EventCounter object at 0x7fb230692e80>
expected = <fury.tests.test_ui.EventCounter object at 0x7fb230692a58>

    def check_counts(self, expected):
        npt.assert_equal(len(self.events_counts),
                         len(expected.events_counts))
    
        # Useful loop for debugging.
        msg = "{}: {} vs. {} (expected)"
        for event, count in expected.events_counts.items():
            if self.events_counts[event] != count:
                print(msg.format(event, self.events_counts[event], count))
    
        msg = "Wrong count for '{}'."
        for event, count in expected.events_counts.items():
            npt.assert_equal(self.events_counts[event], count,
>                            err_msg=msg.format(event))
E           AssertionError: 
E           Items are not equal: Wrong count for 'MouseMoveEvent'.
E            ACTUAL: 0
E            DESIRED: 341

anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:75: AssertionError
_______________________________ test_ui_checkbox _______________________________

args = (), kwargs = {}

    def test_with_xvfb(*args, **kwargs):
        if use_xvfb:
            from xvfbwrapper import Xvfb
            display = Xvfb(width=1920, height=1080)
            display.start()
>       my_test(*args, **kwargs)

anaconda3/lib/python3.7/site-packages/fury/decorators.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:596: in test_ui_checkbox
    event_counter.check_counts(expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <fury.tests.test_ui.EventCounter object at 0x7fb239b06da0>
expected = <fury.tests.test_ui.EventCounter object at 0x7fb239b06ef0>

    def check_counts(self, expected):
        npt.assert_equal(len(self.events_counts),
                         len(expected.events_counts))
    
        # Useful loop for debugging.
        msg = "{}: {} vs. {} (expected)"
        for event, count in expected.events_counts.items():
            if self.events_counts[event] != count:
                print(msg.format(event, self.events_counts[event], count))
    
        msg = "Wrong count for '{}'."
        for event, count in expected.events_counts.items():
            npt.assert_equal(self.events_counts[event], count,
>                            err_msg=msg.format(event))
E           AssertionError: 
E           Items are not equal: Wrong count for 'LeftButtonPressEvent'.
E            ACTUAL: 9
E            DESIRED: 10

anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:75: AssertionError
_____________________________ test_ui_radio_button _____________________________

args = (), kwargs = {}

    def test_with_xvfb(*args, **kwargs):
        if use_xvfb:
            from xvfbwrapper import Xvfb
            display = Xvfb(width=1920, height=1080)
            display.start()
>       my_test(*args, **kwargs)

anaconda3/lib/python3.7/site-packages/fury/decorators.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:667: in test_ui_radio_button
    event_counter.check_counts(expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <fury.tests.test_ui.EventCounter object at 0x7fb239a47d30>
expected = <fury.tests.test_ui.EventCounter object at 0x7fb239a47400>

    def check_counts(self, expected):
        npt.assert_equal(len(self.events_counts),
                         len(expected.events_counts))
    
        # Useful loop for debugging.
        msg = "{}: {} vs. {} (expected)"
        for event, count in expected.events_counts.items():
            if self.events_counts[event] != count:
                print(msg.format(event, self.events_counts[event], count))
    
        msg = "Wrong count for '{}'."
        for event, count in expected.events_counts.items():
            npt.assert_equal(self.events_counts[event], count,
>                            err_msg=msg.format(event))
E           AssertionError: 
E           Items are not equal: Wrong count for 'LeftButtonPressEvent'.
E            ACTUAL: 4
E            DESIRED: 8

anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:75: AssertionError
______________________________ test_ui_listbox_2d ______________________________

args = (), kwargs = {}

    def test_with_xvfb(*args, **kwargs):
        if use_xvfb:
            from xvfbwrapper import Xvfb
            display = Xvfb(width=1920, height=1080)
            display.start()
>       my_test(*args, **kwargs)

anaconda3/lib/python3.7/site-packages/fury/decorators.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:744: in test_ui_listbox_2d
    event_counter.check_counts(expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <fury.tests.test_ui.EventCounter object at 0x7fb23e30ff60>
expected = <fury.tests.test_ui.EventCounter object at 0x7fb2306ded68>

    def check_counts(self, expected):
        npt.assert_equal(len(self.events_counts),
                         len(expected.events_counts))
    
        # Useful loop for debugging.
        msg = "{}: {} vs. {} (expected)"
        for event, count in expected.events_counts.items():
            if self.events_counts[event] != count:
                print(msg.format(event, self.events_counts[event], count))
    
        msg = "Wrong count for '{}'."
        for event, count in expected.events_counts.items():
            npt.assert_equal(self.events_counts[event], count,
>                            err_msg=msg.format(event))
E           AssertionError: 
E           Items are not equal: Wrong count for 'LeftButtonReleaseEvent'.
E            ACTUAL: 6
E            DESIRED: 8

anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:75: AssertionError
_____________________________ test_ui_file_menu_2d _____________________________

args = (), kwargs = {}

    def test_with_xvfb(*args, **kwargs):
        if use_xvfb:
            from xvfbwrapper import Xvfb
            display = Xvfb(width=1920, height=1080)
            display.start()
>       my_test(*args, **kwargs)

anaconda3/lib/python3.7/site-packages/fury/decorators.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

interactive = False

    @xvfb_it
    def test_ui_file_menu_2d(interactive=False):
        filename = "test_ui_file_menu_2d"
        recording_filename = pjoin(DATA_DIR, filename + ".log.gz")
        expected_events_counts_filename = pjoin(DATA_DIR, filename + ".pkl")
    
        # Create temporary directory and files
>       os.mkdir(os.path.join(os.getcwd(), "testdir"))
E       FileExistsError: [Errno 17] File exists: '/home/elef/testdir'

anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:845: FileExistsError
_________________________________ test_record __________________________________

args = (), kwargs = {}

    def skipper_func(*args, **kwargs):
        """Skipper for normal test functions."""
        if skip_val():
            raise SkipTest(get_msg(f, msg))
        else:
>           return f(*args, **kwargs)

anaconda3/lib/python3.7/site-packages/numpy/testing/_private/decorators.py:155: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
anaconda3/lib/python3.7/site-packages/fury/decorators.py:60: in test_with_xvfb
    my_test(*args, **kwargs)
anaconda3/lib/python3.7/site-packages/fury/tests/test_window.py:349: in test_record
    test_content()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

filename = 'fury.png', colors_found = (True, True)

    def test_content(filename='fury.png', colors_found=(True, True)):
        npt.assert_equal(os.path.isfile(filename), True)
        arr = io.load_image(filename)
        report = window.analyze_snapshot(arr, colors=[(0, 255, 0),
                                                      (255, 0, 0)])
>       npt.assert_equal(report.objects, 3)
E       AssertionError: 
E       Items are not equal:
E        ACTUAL: 0
E        DESIRED: 3

anaconda3/lib/python3.7/site-packages/fury/tests/test_window.py:342: AssertionError


Ways to reproduce

[If reporting a bug, please include the following important information:]

  • [ ] Code example Just run all the tests
  • [ ] Operating system and versions (run python -c "from fury import get_info; print(get_info()")
In [1]: import fury; fury.get_info()                                                                                                                                                     
Out[1]: 
{'fury_version': '0.3.0',
 'pkg_path': '/home/elef/anaconda3/lib/python3.7/site-packages/fury',
 'commit_hash': '29293e40eb6229ef9079009f2c705fd54850c06a',
 'sys_version': '3.7.3 | packaged by conda-forge | (default, Jul  1 2019, 21:52:21) \n[GCC 7.3.0]',
 'sys_executable': '/home/elef/anaconda3/bin/python',
 'sys_platform': 'linux',
 'numpy_version': '1.15.4',
 'scipy_version': '1.2.1',
 'vtk_version': '8.1.2',
 'matplotlib_version': '3.0.2',
 'dipy_version': '1.0.0dev'}

Garyfallidis avatar Aug 02 '19 15:08 Garyfallidis

Also what is really strange in Linux is that the tests that replay events take much longer to run than in Windows. This issue needs to be communicated with Kitware.

Garyfallidis avatar Aug 02 '19 15:08 Garyfallidis

I suggest we revisit the EventCounter too. And snapshot. Snapshot started showing up windows again. Not sure why. This is supposed to work offscreen in stealth mode.

Garyfallidis avatar Aug 02 '19 15:08 Garyfallidis

I remember also observing that replaying events was slow but at some point (maybe I changed VTK version) it stopped being slow. I haven't used VTK recently, so maybe it has changed again. I'll make time next week to at least try it out on my Linux laptop without a GPU (I don't have a Linux machine with both a GPU and a screen :P).

MarcCote avatar Aug 07 '19 02:08 MarcCote

Well, I've been using fury for about a week on my Linux machine but it's not showing up any OS related problems. All the tests are passed too except #159 which again is not a Linux issue. Here is my get_info output: {'sys_executable': '/usr/bin/python', 'fury_version': '0.4.0.post252+g4dbc3cc', 'numpy_version': '1.16.6', 'sys_platform': 'linux2', 'sys_version': '2.7.17 (default, Nov 7 2019, 10:07:09) \n[GCC 9.2.1 20191008]', 'commit_hash': '4dbc3cc3c4206c80613c320efc59cb28ac3a9efb', 'dipy_version': '0.16.0', 'pkg_path': 'fury', 'vtk_version': '8.1.2', 'scipy_version': '1.2.3'}

hnumair avatar Mar 12 '20 00:03 hnumair