Skip to content

Test that connection dialog remembers passphrase/password fails when not in CI #23533

@mrclary

Description

@mrclary

The following assertions fail when running on macOS locally (not in CI):

if not running_in_ci():
assert new_dlg.kfp.text() == pytest.kfp

if not running_in_ci():
assert new_dlg.pw.text() == pytest.pw

The pytest output is similar for both failures:

pytest output
(spy-dev) >> python runtests.py spyder/plugins/ipythonconsole/widgets/tests/test_kernelconnect.py::test_connection_dialog_remembers_input_with_ssh_passphrase
Pytest Arguments: ['-vv', '-rw', '--durations=10', '--ignore=./external-deps', '-W ignore::UserWarning', '--timeout=120', '--timeout_method=thread', 'spyder/plugins/ipythonconsole/widgets/tests/test_kernelconnect.py::test_connection_dialog_remembers_input_with_ssh_passphrase', '--ignore=./spyder/plugins/remoteclient']
================================================= test session starts ==================================================
platform darwin -- Python 3.11.11, pytest-7.4.4, pluggy-1.5.0 -- /Users/rclary/.conda/envs/spy-dev/bin/python
cachedir: .pytest_cache
PyQt5 5.15.9 -- Qt runtime 5.15.15 -- Qt compiled 5.15.8
rootdir: /Users/rclary/Documents/Repos/Spyder-IDE/spyder
configfile: pytest.ini
plugins: qt-4.4.0, cov-6.0.0, flaky-3.8.1, order-1.3.0, timeout-2.3.1, mock-3.14.0, lazy-fixture-0.6.3
timeout: 120.0s
timeout method: thread
timeout func_only: False
collected 1 item                                                                                                       

spyder/plugins/ipythonconsole/widgets/tests/test_kernelconnect.py::test_connection_dialog_remembers_input_with_ssh_passphrase FAILED [100%]

======================================================= FAILURES =======================================================
______________________________ test_connection_dialog_remembers_input_with_ssh_passphrase ______________________________

qtbot = <pytestqt.qtbot.QtBot object at 0x116cab090>
connection_dialog_factory = <spyder.plugins.ipythonconsole.widgets.tests.test_kernelconnect.connection_dialog_factory.<locals>.DialogFactory object at 0x116c1ad10>

    def test_connection_dialog_remembers_input_with_ssh_passphrase(
            qtbot, connection_dialog_factory):
        """
        Test that the dialog remembers the user's kernel connection
        settings and ssh key passphrase when the user checks the
        save checkbox.
        """
    
        dlg = connection_dialog_factory.submit_filled_dialog(use_keyfile=True,
                                                             save_settings=True)
    
        # Press ok and save connection settings
        qtbot.mouseClick(dlg.accept_btns.button(QDialogButtonBox.Ok),
                         Qt.LeftButton)
    
        # create new dialog and check fields
        new_dlg = connection_dialog_factory.get_default_dialog()
        assert new_dlg.cf.text() == pytest.cf_path
        assert new_dlg.rm_group.isChecked()
        assert new_dlg.hn.text() == pytest.hn
        assert new_dlg.un.text() == pytest.un
        assert new_dlg.pn.text() == str(pytest.pn)
        assert new_dlg.kf.text() == pytest.kf
        if not running_in_ci():
>           assert new_dlg.kfp.text() == pytest.kfp
E           AssertionError: assert '' == 'test_kfp'
E             - test_kfp

spyder/plugins/ipythonconsole/widgets/tests/test_kernelconnect.py:133: AssertionError
=================================================== warnings summary ===================================================
spyder/config/base.py:441
  /Users/rclary/Documents/Repos/Spyder-IDE/spyder/spyder/config/base.py:441: DeprecationWarning: 'locale.getdefaultlocale' is deprecated and slated for removal in Python 3.15. Use setlocale(), getencoding() and getlocale() instead.
    locale_language = locale.getdefaultlocale()[0]

../../../../.conda/envs/spy-dev/lib/python3.11/site-packages/applaunchservices/__init__.py:45
../../../../.conda/envs/spy-dev/lib/python3.11/site-packages/applaunchservices/__init__.py:45
  /Users/rclary/.conda/envs/spy-dev/lib/python3.11/site-packages/applaunchservices/__init__.py:45: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    or V(platform.mac_ver()[0]) < V("10.4")):

spyder/plugins/ipythonconsole/widgets/kernelconnect.py:15
  /Users/rclary/Documents/Repos/Spyder-IDE/spyder/spyder/plugins/ipythonconsole/widgets/kernelconnect.py:15: 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.paths import jupyter_runtime_dir

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================= slowest 10 durations =================================================
0.70s setup    spyder/plugins/ipythonconsole/widgets/tests/test_kernelconnect.py::test_connection_dialog_remembers_input_with_ssh_passphrase
0.12s call     spyder/plugins/ipythonconsole/widgets/tests/test_kernelconnect.py::test_connection_dialog_remembers_input_with_ssh_passphrase
0.01s teardown spyder/plugins/ipythonconsole/widgets/tests/test_kernelconnect.py::test_connection_dialog_remembers_input_with_ssh_passphrase
============================================ 1 failed, 4 warnings in 3.77s =============================================

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions