Skip to content

Commit

Permalink
Merge pull request #197 from jitseniesen/spyder6
Browse files Browse the repository at this point in the history
Use Spyder's new PythonpathManager plugin
  • Loading branch information
jitseniesen committed Apr 14, 2023
2 parents 077e8fa + e489a5a commit d043cde
Show file tree
Hide file tree
Showing 10 changed files with 277 additions and 108 deletions.
17 changes: 17 additions & 0 deletions .github/scripts/generate-without-spyder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env python
#
# Copyright (c) Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)

"""Script to generate requirements/without-spyder.txt"""

import re

with open('requirements/conda.txt') as infile:
with open('requirements/without-spyder.txt', 'w') as outfile:
for line in infile:
package_name = re.match('[-a-z0-9_]*', line).group(0)
if package_name != 'spyder':
outfile.write(line)

22 changes: 8 additions & 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: ['git']
name: ${{ matrix.OS }} py${{ matrix.PYTHON_VERSION }} spyder-from-${{ matrix.SPYDER_SOURCE }}
runs-on: ${{ matrix.OS }}-latest
env:
Expand Down Expand Up @@ -70,7 +57,14 @@ jobs:
if: matrix.SPYDER_SOURCE == 'git'
shell: bash -l {0}
run: pip install --no-deps -e spyder
- name: Install plugin dependencies (without Spyder)
if: matrix.SPYDER_SOURCE == 'git'
shell: bash -l {0}
run: |
python .github/scripts/generate-without-spyder.py
mamba install --file requirements/without-spyder.txt -y
- name: Install plugin dependencies
if: matrix.SPYDER_SOURCE == 'conda'
shell: bash -l {0}
run: mamba install --file requirements/conda.txt -y
- name: Install test dependencies
Expand Down
23 changes: 23 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
#

"""Configuration file for Pytest."""

# Standard library imports
import os

# To activate/deactivate certain things in Spyder when running tests.
# NOTE: Please leave this before any other import here!!
os.environ['SPYDER_PYTEST'] = 'True'

# Third-party imports
import pytest


@pytest.fixture(autouse=True)
def reset_conf_before_test():
from spyder.config.manager import CONF
CONF.reset_to_defaults(notification=False)
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.3.1,<6
spyder>=6.0.0.dev0,<7
1 change: 0 additions & 1 deletion requirements/tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ flaky
nose
pytest>=5
pytest-cov
pytest-mock
pytest-qt
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.3.1,<6', 'pyzmq']
REQUIREMENTS = ['lxml', 'spyder>=6.0.0.dev0,<7', 'pyzmq']
EXTLIST = ['.jpg', '.png', '.json', '.mo', '.ini']
LIBNAME = 'spyder_unittest'

Expand Down
4 changes: 2 additions & 2 deletions spyder_unittest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# Copyright © 2013 Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
"""Spyder unitest plugin."""
"""Spyder unittest plugin."""

# Local imports
from .unittestplugin import UnitTestPlugin as PLUGIN_CLASS

__version__ = '0.5.2.dev0'
__version__ = '0.6.0.dev0'
PLUGIN_CLASS
45 changes: 45 additions & 0 deletions spyder_unittest/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
"""
Configuration file for Pytest.
This contains the necessary definitions to make the main_window fixture
available for integration tests.
"""

# Third-party imports
from qtpy.QtWidgets import QApplication
import pytest

# QtWebEngineWidgets must be imported
# before a QCoreApplication instance is created
from qtpy import QtWebEngineWidgets # noqa

# Spyder imports
from spyder.app import start
from spyder.config.manager import CONF


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

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

from spyder.api.plugin_registration.registry import PLUGIN_REGISTRY
PLUGIN_REGISTRY.reset()

# Start the window
window = start.main()
QApplication.processEvents()

yield window

# Close main window
window.close()
CONF.reset_to_defaults(notification=False)

0 comments on commit d043cde

Please sign in to comment.