Skip to content

Commit

Permalink
Restrict to Spyder 5 only
Browse files Browse the repository at this point in the history
  • Loading branch information
jitseniesen committed Jun 30, 2023
1 parent da9fbc1 commit 04c99d8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 41 deletions.
15 changes: 1 addition & 14 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,7 @@ jobs:
matrix:
OS: ['ubuntu', 'macos', 'windows']
PYTHON_VERSION: ['3.8', '3.9', '3.10']
SPYDER_SOURCE: ['conda', 'git']
exclude:
- OS: 'macos'
PYTHON_VERSION: '3.8'
SPYDER_SOURCE: 'git'
- OS: 'macos'
PYTHON_VERSION: '3.9'
SPYDER_SOURCE: 'git'
- OS: 'windows'
PYTHON_VERSION: '3.8'
SPYDER_SOURCE: 'git'
- OS: 'windows'
PYTHON_VERSION: '3.9'
SPYDER_SOURCE: 'git'
SPYDER_SOURCE: ['conda']
name: ${{ matrix.OS }} py${{ matrix.PYTHON_VERSION }} spyder-from-${{ matrix.SPYDER_SOURCE }}
runs-on: ${{ matrix.OS }}-latest
env:
Expand Down
2 changes: 1 addition & 1 deletion requirements/conda.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
lxml
spyder>=5.4.1,<7
spyder>=5.4.1,<6
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_package_data(name, extlist):


# Requirements
REQUIREMENTS = ['lxml', 'spyder>=5.4.1,<7', 'pyzmq']
REQUIREMENTS = ['lxml', 'spyder>=5.4.1,<6', 'pyzmq']
EXTLIST = ['.jpg', '.png', '.json', '.mo', '.ini']
LIBNAME = 'spyder_unittest'

Expand Down
10 changes: 3 additions & 7 deletions spyder_unittest/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,18 @@

# Spyder imports
from spyder import dependencies
from spyder import version_info as spyder_version_info
from spyder.api.plugin_registration.registry import PLUGIN_REGISTRY
from spyder.app import start
from spyder.config.manager import CONF

SPYDER6 = spyder_version_info[0] == 6


@pytest.fixture
def main_window(monkeypatch):
"""Main Window fixture"""

if not SPYDER6:
# Disable loading of old third-party plugins in Spyder 5
monkeypatch.setattr(
'spyder.app.mainwindow.get_spyderplugins_mods', lambda: [])
# Disable loading of old third-party plugins in Spyder 5
monkeypatch.setattr(
'spyder.app.mainwindow.get_spyderplugins_mods', lambda: [])

# Don't show tours message
CONF.set('tours', 'show_tour_message', False)
Expand Down
21 changes: 3 additions & 18 deletions spyder_unittest/tests/test_unittestplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,18 @@
from qtpy.QtCore import Qt

# Spyder imports
from spyder import version_info as spyder_version_info
from spyder.api.plugins import Plugins
from spyder.plugins.mainmenu.api import ApplicationMenus

# Local imports
from spyder_unittest.unittestplugin import UnitTestPlugin
from spyder_unittest.widgets.configdialog import Config

SPYDER6 = spyder_version_info[0] == 6


def test_menu_item(main_window):
"""
Test that plugin adds item 'Run unit tests' to Run menu.
"""
if SPYDER6:
main_menu = main_window.get_plugin(Plugins.MainMenu)
run_menu = main_menu.get_application_menu(ApplicationMenus.Run)
actions = run_menu.get_actions()
else:
actions = main_window.run_menu_actions
actions = main_window.run_menu_actions

# Filter out seperators (indicated by action is None) and convert to text
menu_items = [action.text() for action in actions if action]
Expand Down Expand Up @@ -71,10 +62,7 @@ def test_default_working_dir(main_window, tmpdir):

assert unittest_plugin.get_widget().default_wdir == os.getcwd()

if SPYDER6:
projects.create_project(project_dir)
else:
projects._create_project(project_dir)
projects._create_project(project_dir)
assert unittest_plugin.get_widget().default_wdir == project_dir

projects.close_project()
Expand All @@ -96,10 +84,7 @@ def test_plugin_config(main_window, tmpdir, qtbot):
assert unittest_widget.config is None

# Create new project
if SPYDER6:
projects.create_project(project_dir)
else:
projects._create_project(project_dir)
projects._create_project(project_dir)

# Test config file does exist but config is empty
assert config_file_path.check()
Expand Down

0 comments on commit 04c99d8

Please sign in to comment.