spyder-ide / spyder-notebook

Jupyter notebook integration with Spyder
Other
534 stars 130 forks source link

Write a test to check that Spyder's preferences work #472

Closed jitseniesen closed 2 months ago

jitseniesen commented 2 months ago

Write a test which would have caught the embarrassing bug in #470. We do have one test which opens the notebook preferences page, but that did not catch the bug, so investigate.

ccordoba12 commented 2 months ago

For that you can take a look at spyder/plugins/preferences/tests/conftest.py. The config_dialog fixture allows to test config pages in the Preferences dialog, as it's done in spyder/plugins/pylint/tests/test_pylint_config_dialog.py, for instance.

jitseniesen commented 2 months ago

There already is a test using the config_dialog fixture, but that did not catch this particular error. The reason for this seems to be that the code behaves differently when run in a test because of https://github.com/spyder-ide/spyder/blob/5d9b4dadb27ffc3e0ace7a45e885e1d0b74927da/spyder/api/plugin_registration/registry.py#L390:

        if plugin_name == Plugins.Preferences and not running_under_pytest():