Skip to content

Commit

Permalink
Merge pull request #223 from jitseniesen/spyder6
Browse files Browse the repository at this point in the history
PR: Update to released version of Spyder 6
  • Loading branch information
jitseniesen authored Sep 3, 2024
2 parents 6ccacfc + b2974b8 commit 5251765
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 36 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ jobs:
matrix:
OS: ['ubuntu', 'macos', 'windows']
PYTHON_VERSION: ['3.9', '3.10', '3.11']
# Do not test against conda for the moment because latest Spyder
# version on conda-forge is 6.0.0alpha2 which is not compatible
# with Spyder's master branch
SPYDER_SOURCE: ['git']
SPYDER_SOURCE: ['conda', 'git']
name: ${{ matrix.OS }} py${{ matrix.PYTHON_VERSION }} spyder-from-${{ matrix.SPYDER_SOURCE }}
runs-on: ${{ matrix.OS }}-latest
env:
Expand Down
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,21 @@ Support for `pytest` is most complete at the moment.

## Installation

The unittest plugin is available in the `spyder-ide` channel in Anaconda and in PyPI,
so it can be installed with the following commands:
To install this plugin, you can use either ``pip`` or ``conda`` package managers, as follows:

* Using Anaconda: `conda install -c spyder-ide spyder-unittest`
* Using pip: `pip install spyder-unittest`
Using conda (the recommended way!):

All dependencies will be automatically installed.
You have to restart Spyder before you can use the plugin.
```
conda install spyder-unittest -c conda-forge
```

Using pip:

```
pip install spyder-unittest
```

**Note**: At the moment it is not possible to use this plugin with the [Spyder installers](http://docs.spyder-ide.org/current/installation.html#standalone-installers) for Windows and macOS. We're working to make that a reality in the future.


## Usage
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>=6,<7
4 changes: 2 additions & 2 deletions 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>=6.0.0.dev0,<7', 'pyzmq']
REQUIREMENTS = ['lxml', 'spyder>=6,<7', 'pyzmq']
EXTLIST = ['.jpg', '.png', '.json', '.mo', '.ini']
LIBNAME = 'spyder_unittest'

Expand All @@ -56,7 +56,7 @@ def get_package_data(name, extlist):
packages=find_packages(),
package_data={LIBNAME: get_package_data(LIBNAME, EXTLIST)},
keywords=["Qt PyQt4 PyQt5 spyder plugins testing"],
python_requires='>=3.7',
python_requires='>=3.8',
install_requires=REQUIREMENTS,
url='https://github.com/spyder-ide/spyder-unittest',
license='MIT',
Expand Down
7 changes: 0 additions & 7 deletions spyder_unittest/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,11 @@
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: [])

# Don't show tours message
CONF.set('tours', 'show_tour_message', False)

Expand Down
21 changes: 5 additions & 16 deletions spyder_unittest/tests/test_unittestplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,14 @@
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
main_menu = main_window.get_plugin(Plugins.MainMenu)
run_menu = main_menu.get_application_menu(ApplicationMenus.Run)
actions = run_menu.get_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 +66,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 +88,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 5251765

Please sign in to comment.