spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.34k stars 1.62k forks source link

Three spyder/utils/tests/test_programs.py failures with Qt 5.15.2 #17107

Closed juliangilbey closed 2 years ago

juliangilbey commented 2 years ago

Issue Report Checklist

Problem Description

I'm really hoping this is the last set of test failures with 5.15.2.... It's three tests in spyder/utils/tests/test_programs.py which I'd originally thought might be something to do with my setup, but am now thinking are more likely related to using Python 3.10 and/or Qt 5.15.2.

What steps reproduce the problem?

(sid-minimal)jdg@euler:/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1$ debian/tests/pytest spyder/utils/tests/test_programs.py
Testing with python3.10:
Temporary home directory: /tmp/tmp.AWjR1cLL2o
Pytest Arguments: ['-vv', '-rw', '--durations=10', '-W ignore::UserWarning', '-k', 'not test_get_pydoc and not test_qtbug35861 and not test_find_external_plugins and not test_load_time and not test_objectexplorer_collection_types and not test_pylint.py and not test_object_arrays_display and not test_profiler_config_dialog.py and not test_handle_exception', 'spyder/utils/tests/test_programs.py']
============================= test session starts ==============================
platform linux -- Python 3.10.1, pytest-6.2.5, py-1.10.0, pluggy-0.13.0 -- /usr/bin/python3.10
cachedir: .pytest_cache
PyQt5 5.15.6 -- Qt runtime 5.15.2 -- Qt compiled 5.15.2
rootdir: /build/spyder-jdg/build-area/spyder-5.2.1+dfsg1, configfile: pytest.ini
plugins: flaky-3.7.0, xvfb-2.0.0, mock-3.6.1, cov-3.0.0, order-1.0.0, qt-4.0.2, lazy-fixture-0.6.3
collected 19 items                                                             

spyder/utils/tests/test_programs.py::test_run_python_script_in_terminal_blank_wdir FAILED [  5%]
spyder/utils/tests/test_programs.py::test_run_python_script_in_terminal_with_wdir_empty FAILED [ 10%]
spyder/utils/tests/test_programs.py::test_is_valid_interpreter PASSED    [ 15%]
spyder/utils/tests/test_programs.py::test_is_invalid_interpreter PASSED  [ 21%]
spyder/utils/tests/test_programs.py::test_is_valid_interpreter_name PASSED [ 26%]
spyder/utils/tests/test_programs.py::test_is_valid_w_interpreter SKIPPED [ 31%]
spyder/utils/tests/test_programs.py::test_run_python_script_in_terminal FAILED [ 36%]
spyder/utils/tests/test_programs.py::test_find_program PASSED            [ 42%]
spyder/utils/tests/test_programs.py::test_shell_split PASSED             [ 47%]
spyder/utils/tests/test_programs.py::test_check_version PASSED           [ 52%]
spyder/utils/tests/test_programs.py::test_is_module_installed PASSED     [ 57%]
spyder/utils/tests/test_programs.py::test_is_module_installed_with_custom_interpreter PASSED [ 63%]
spyder/utils/tests/test_programs.py::test_get_temp_dir_ensure_dir_exists PASSED [ 68%]
spyder/utils/tests/test_programs.py::test_clean_win_application_path PASSED [ 73%]
spyder/utils/tests/test_programs.py::test_get_installed_apps_and_icons PASSED [ 78%]
spyder/utils/tests/test_programs.py::test_parse_linux_desktop_entry PASSED [ 84%]
spyder/utils/tests/test_programs.py::test_open_files_with_application PASSED [ 89%]
spyder/utils/tests/test_programs.py::test_get_package_version PASSED     [ 94%]
spyder/utils/tests/test_programs.py::test_get_module_version PASSED      [100%]

=================================== FAILURES ===================================
________________ test_run_python_script_in_terminal_blank_wdir _________________

scriptpath_with_blanks = local('/tmp/pytest-of-jdg/pytest-120/test_run_python_script_in_term2/write-done.py')
qtbot = <pytestqt.qtbot.QtBot object at 0x7f5cd8733010>

    @flaky(max_runs=3)
    @pytest.mark.order(1)
    @pytest.mark.skipif(
        not running_in_ci() or os.name == 'nt',
        reason='Only on CI and not on windows!',
    )
    def test_run_python_script_in_terminal_blank_wdir(scriptpath_with_blanks,
                                                      qtbot):
        """
        Test running a Python script in an external terminal when specifying
        explicitly the working directory.
        """
        # Run the script
        outfilepath = osp.join(scriptpath_with_blanks.dirname, 'out.txt')
        run_python_script_in_terminal(
            scriptpath_with_blanks.strpath, scriptpath_with_blanks.dirname,
            '', False, False, '')
>       qtbot.waitUntil(lambda: osp.exists(outfilepath), timeout=10000)
E       pytestqt.exceptions.TimeoutError: waitUntil timed out in 10000 milliseconds

/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/utils/tests/test_programs.py:112: TimeoutError
______________ test_run_python_script_in_terminal_with_wdir_empty ______________

scriptpath = local('/tmp/pytest-of-jdg/pytest-120/test_run_python_script_in_term5/write-done.py')
qtbot = <pytestqt.qtbot.QtBot object at 0x7f5cd8784460>

    @flaky(max_runs=3)
    @pytest.mark.order(1)
    @pytest.mark.skipif(
        not running_in_ci() or os.name == 'nt',
        reason='Only on CI and not on windows!',
    )
    def test_run_python_script_in_terminal_with_wdir_empty(scriptpath, qtbot):
        """
        Test running a Python script in an external terminal without specifying
        the working directory.
        """
        # Run the script.
        if sys.platform == 'darwin':
            outfilepath = osp.join(osp.expanduser('~'), 'out.txt')
        else:
            outfilepath = osp.join(os.getcwd(), 'out.txt')

        run_python_script_in_terminal(scriptpath.strpath, '', '', False, False, '')
>       qtbot.waitUntil(lambda: osp.exists(outfilepath), timeout=10000)
E       pytestqt.exceptions.TimeoutError: waitUntil timed out in 10000 milliseconds

/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/utils/tests/test_programs.py:137: TimeoutError
______________________ test_run_python_script_in_terminal ______________________

scriptpath = local('/tmp/pytest-of-jdg/pytest-120/test_run_python_script_in_term8/write-done.py')
qtbot = <pytestqt.qtbot.QtBot object at 0x7f5cd879ecb0>

    @flaky(max_runs=3)
    @pytest.mark.skipif(not running_in_ci(), reason='Only on CI!')
    def test_run_python_script_in_terminal(scriptpath, qtbot):
        """
        Test running a Python script in an external terminal when specifying
        explicitly the working directory.
        """
        # Run the script
        outfilepath = osp.join(scriptpath.dirname, 'out.txt')
        run_python_script_in_terminal(
            scriptpath.strpath, scriptpath.dirname, '', False, False, '')
>       qtbot.waitUntil(lambda: osp.exists(outfilepath), timeout=10000)
E       pytestqt.exceptions.TimeoutError: waitUntil timed out in 10000 milliseconds

/build/spyder-jdg/build-area/spyder-5.2.1+dfsg1/spyder/utils/tests/test_programs.py:88: TimeoutError
[... snip flaky and slowest runs report ...]
============== 3 failed, 15 passed, 1 skipped in 91.87s (0:01:31) ==============

Versions

Dependencies

# Mandatory:
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  4.0.0 (OK)
cloudpickle >=0.5.0           :  2.0.0 (OK)
cookiecutter >=1.6.0          :  1.7.3 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.0.2 (OK)
IPython >=7.6.0               :  7.27.0 (OK)
jedi >=0.17.2;<0.19.0         :  0.18.0 (OK)
jellyfish >=0.7               :  0.8.9 (OK)
jsonschema >=3.2.0            :  3.2.0 (OK)
keyring >=17.0.0              :  23.3.0 (OK)
nbconvert >=4.0               :  6.1.0 (OK)
numpydoc >=0.6.0              :  1.1.0 (OK)
parso >=0.7.0;<0.9.0          :  0.8.1 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.8.0 (OK)
pygments >=2.0                :  2.7.1 (OK)
pylint >=2.5.0                :  2.12.2 (OK)
pyls_spyder >=0.4.0           :  0.4.0 (OK)
pylsp >=1.3.2;<1.4.0          :  1.3.3 (OK)
pylsp_black >=1.0.0           :  1.0.1 (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.2.1 (OK)
qtawesome >=1.0.2             :  1.1.1 (OK)
qtconsole >=5.2.1;<5.3.0      :  5.2.1 (OK)
qtpy >=1.5.0                  :  1.9.0 (OK)
rtree >=0.9.7                 :  0.9.7 (OK)
setuptools >=49.6.0           :  58.2.0 (OK)
sphinx >=0.6.6                :  4.3.2 (OK)
spyder_kernels >=2.2.0;<2.3.0 :  2.2.0 (OK)
textdistance >=4.2.0          :  4.2.2 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3             :  2.1.6 (OK)
xdg >=0.26                    :  0.27 (OK)
zmq >=17                      :  22.3.0 (OK)

# Optional:
cython >=0.21                 :  0.29.24 (OK)
matplotlib >=2.0.0            :  3.3.4 (OK)
numpy >=1.7                   :  1.21.5 (OK)
pandas >=1.1.1                :  1.3.4 (OK)
scipy >=0.17.0                :  1.7.1 (OK)
sympy >=0.7.3                 :  1.7.1 (OK)
ccordoba12 commented 2 years ago

You need to have a graphical system terminal for those tests to pass (e.g. xterm). Please install it on your side and try again.

juliangilbey commented 2 years ago

Ah, thanks! That did it. (As I said, I'm running in a minimal environment!)