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

2 tests fail #502

Closed
yurivict opened this issue Sep 6, 2024 · 1 comment
Closed

2 tests fail #502

yurivict opened this issue Sep 6, 2024 · 1 comment

Comments

@yurivict
Copy link

yurivict commented Sep 6, 2024

========================================================================================= FAILURES ==========================================================================================
___________________________________________________________________________________ test_load_dicom_files ___________________________________________________________________________________
[gw1] freebsd14 -- Python 3.11.9 /usr/local/bin/python3.11

    def test_load_dicom_files():
        """Check that we can load DICOM files."""
        # This test pass locally but we need to set the variable below for it to
        # pass on CIs.
        # See https://stackoverflow.com/a/47958486/438386 for context.
        ImageFile.LOAD_TRUNCATED_IMAGES = True
    
        data = iofuncs.load_dicom(os.path.join(LOCATION, 'data.dcm'))
>       assert data[0]['data'].shape == (512, 512)
E       TypeError: 'NoneType' object is not subscriptable

spyder_kernels/utils/tests/test_iofuncs.py:361: TypeError
______________________________________________________________________________________ test_interrupt _______________________________________________________________________________________
[gw2] freebsd14 -- Python 3.11.9 /usr/local/bin/python3.11

    def test_interrupt():
        """
        Test that the kernel can be interrupted by calling a comm handler.
        """
        # Command to start the kernel
        cmd = "from spyder_kernels.console import start; start.main()"
        with setup_kernel(cmd) as client:
            kernel_comm = CommBase()
    
            # Create new comm and send the highest protocol
            comm = Comm(kernel_comm._comm_name, client)
            comm.open(data={})
            comm._send_channel = client.control_channel
            kernel_comm._register_comm(comm)
    
            client.execute_interactive("import time", timeout=TIMEOUT)
    
            # Try interrupting loop
            t0 = time.time()
            msg_id = client.execute("for i in range(100): time.sleep(.1)")
            time.sleep(.2)
            # Raise interrupt on control_channel
            kernel_comm.remote_call().raise_interrupt_signal()
            # Wait for shell message
            while True:
                assert time.time() - t0 < 5
                msg = client.get_shell_msg(timeout=TIMEOUT)
                if msg["parent_header"].get("msg_id") != msg_id:
                    # not from my request
                    continue
                break
            assert time.time() - t0 < 5
    
            if os.name == 'nt':
                # Windows doesn't do "interrupting sleep"
                return
    
            # Try interrupting sleep
            t0 = time.time()
            msg_id = client.execute("time.sleep(10)")
            time.sleep(.2)
            # Raise interrupt on control_channel
            kernel_comm.remote_call().raise_interrupt_signal()
            # Wait for shell message
            while True:
                assert time.time() - t0 < 5
                msg = client.get_shell_msg(timeout=TIMEOUT)
                if msg["parent_header"].get("msg_id") != msg_id:
                    # not from my request
                    continue
                break
>           assert time.time() - t0 < 5
E           assert (1725650273.4477134 - 1725650263.436418) < 5
E            +  where 1725650273.4477134 = <built-in function time>()
E            +    where <built-in function time> = time.time

spyder_kernels/console/tests/test_console_kernel.py:1323: AssertionError
===================================================================================== warnings summary ======================================================================================
spyder_kernels/console/tests/test_console_kernel.py:29
spyder_kernels/console/tests/test_console_kernel.py:29
spyder_kernels/console/tests/test_console_kernel.py:29
spyder_kernels/console/tests/test_console_kernel.py:29
  /usr/ports/devel/py-spyder-kernels/work-py311/spyder_kernels-3.0.0/spyder_kernels/console/tests/test_console_kernel.py:29: DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
  given by the platformdirs library.  To remove this warning and
  see the appropriate new directories, set the environment variable
  `JUPYTER_PLATFORM_DIRS=1` and then run `jupyter --paths`.
  The use of platformdirs will be the default in `jupyter_core` v6
    from jupyter_core import paths

spyder_kernels/utils/tests/test_nsview.py::test_get_type_string
  /usr/ports/devel/py-spyder-kernels/work-py311/spyder_kernels-3.0.0/spyder_kernels/utils/tests/test_nsview.py:335: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
    matrix = np.matrix([[1, 2], [3, 4]])

spyder_kernels/utils/tests/test_nsview.py::test_get_numpy_type
  /usr/ports/devel/py-spyder-kernels/work-py311/spyder_kernels-3.0.0/spyder_kernels/utils/tests/test_nsview.py:428: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
    matrix = np.matrix([[1, 2], [3, 4]])

spyder_kernels/utils/tests/test_iofuncs.py::test_spydata_import_witherror
  <frozen importlib._bootstrap>:744: DeprecationWarning: BuiltinImporter.module_repr() is deprecated and slated for removal in Python 3.12

spyder_kernels/utils/tests/test_nsview.py::test_is_editable_type
  /usr/ports/devel/py-spyder-kernels/work-py311/spyder_kernels-3.0.0/spyder_kernels/utils/tests/test_nsview.py:390: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
    matrix = np.matrix([[1, 2], [3, 4]])

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

-------- coverage: platform freebsd14, python 3.11.9-final-0 ---------
Name                                                                                  Stmts   Miss  Cover
---------------------------------------------------------------------------------------------------------
/tmp/pytest-of-yuri/pytest-21/popen-gw2/test_umr_previous_modules0/foo2/__init__.py       0      0   100%
/tmp/pytest-of-yuri/pytest-21/popen-gw2/test_umr_reload_modules0/foo3/__init__.py         0      0   100%
/tmp/pytest-of-yuri/pytest-21/popen-gw2/test_umr_run0/foo1/__init__.py                    0      0   100%
/tmp/pytest-of-yuri/pytest-21/popen-gw2/test_umr_run0/foo1/bar.py                         2      1    50%
spyder_kernels/__init__.py                                                                1      0   100%
spyder_kernels/_version.py                                                                2      0   100%
spyder_kernels/comms/__init__.py                                                          1      0   100%
spyder_kernels/comms/commbase.py                                                        258    138    47%
spyder_kernels/comms/decorators.py                                                        8      0   100%
spyder_kernels/comms/frontendcomm.py                                                    112     80    29%
spyder_kernels/comms/utils.py                                                            36     25    31%
spyder_kernels/console/__init__.py                                                        0      0   100%
spyder_kernels/console/kernel.py                                                        598    371    38%
spyder_kernels/console/shell.py                                                         208     96    54%
spyder_kernels/customize/__init__.py                                                      0      0   100%
spyder_kernels/customize/code_runner.py                                                 250    184    26%
spyder_kernels/customize/namespace_manager.py                                            64     55    14%
spyder_kernels/customize/spyderpdb.py                                                   479    316    34%
spyder_kernels/customize/umr.py                                                          39      5    87%
spyder_kernels/customize/utils.py                                                        91     21    77%
spyder_kernels/utils/__init__.py                                                          0      0   100%
spyder_kernels/utils/dochelpers.py                                                      204     56    73%
spyder_kernels/utils/iofuncs.py                                                         342     78    77%
spyder_kernels/utils/lazymodules.py                                                      20      0   100%
spyder_kernels/utils/misc.py                                                             27      6    78%
spyder_kernels/utils/mpl.py                                                              12      7    42%
spyder_kernels/utils/nsview.py                                                          376    134    64%
spyder_kernels/utils/pythonenv.py                                                        45     14    69%
spyder_kernels/utils/test_utils.py                                                       25      2    92%
---------------------------------------------------------------------------------------------------------
TOTAL                                                                                  3200   1589    50%

===Flaky Test Report===

test_cwd_in_sys_path passed 1 out of the required 1 times. Success!
test_multiprocessing passed 1 out of the required 1 times. Success!
test_matplotlib_inline passed 1 out of the required 1 times. Success!
test_multiprocessing_2 passed 1 out of the required 1 times. Success!
test_np_threshold passed 1 out of the required 1 times. Success!
test_debug_namespace passed 1 out of the required 1 times. Success!
test_runfile passed 1 out of the required 1 times. Success!

===End Flaky Test Report===
================================================================================== short test summary info ==================================================================================
SKIPPED [4] spyder_kernels/console/tests/test_console_kernel.py:1141: Doesn't work with pip packages
SKIPPED [1] spyder_kernels/console/tests/test_console_kernel.py:605: Doesn't work with pip packages
SKIPPED [1] spyder_kernels/console/tests/test_console_kernel.py:1413: Only works on CIs
SKIPPED [1] spyder_kernels/console/tests/test_console_kernel.py:792: Doesn't work on non-interactive settings or Python without Tk
============================================================== 2 failed, 100 passed, 7 skipped, 8 warnings in 84.36s (0:01:24) ==============================================================
*** Error code 1

Version: 3.0.0
Python-3.11
FreeBSD 14.1

@ccordoba12
Copy link
Member

Hey @yurivict, thanks for reporting. The first failing test (test_load_dicom_files) should be fixed in 3.0.1, which I'm going to release right in a few minutes. And the second one (test_interrupt), was already reported in issue #501. So, I'm going to close this issue in favor of that one.

@ccordoba12 ccordoba12 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants