Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Compatibility fixes for Spyder 4 #131

Merged
merged 5 commits into from
Jan 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 8 additions & 50 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,79 +2,37 @@ version: 2

main: &main
machine: true
environment:
# Used by qthelpers to close widgets after a defined time
- TEST_CI: "True"
- TEST_CI_APP: "True"
steps:
- checkout
- run:
command: docker pull dorowu/ubuntu-desktop-lxde-vnc:trusty
- run:
name: Install system packages
command: |
sudo apt-get update
sudo apt-get install libegl1-mesa
sudo apt-get -qq update
sudo apt-get install -q libegl1-mesa
- run:
name: Install Miniconda
command: |
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
conda install python=$PYTHON_VERSION
command: bash ./continuous_integration/circle/install.sh
- run:
name: Install Spyder from GitHub
command: |
export PATH="$HOME/miniconda/bin:$PATH"
conda install --only-deps spyder
mkdir spyder-source
cd spyder-source
wget -q https://github.com/spyder-ide/spyder/archive/3.x.zip
unzip -q 3.x.zip
cd spyder-3.x
python setup.py install
- run:
name: Set up test environment
command: |
export PATH="$HOME/miniconda/bin:$PATH"
python setup.py develop
conda install -q mock nose pytest
conda install -q -c spyder-ide pytest-cov
pip install coveralls pytest-qt
command: bash ./continuous_integration/circle/run_tests.sh
- run:
name: Run tests
command: |
export PATH="$HOME/miniconda/bin:$PATH"
mkdir test-reports
pytest spyder_unittest --cov=spyder_unittest --junitxml=test-reports/junit.xml
COVERALLS_REPO_TOKEN=c5Qt1n27dLFCAIESYVkuCmVpUU8doney1 coveralls
- run:
name: Run style checks
command: |
export PATH="$HOME/miniconda/bin:$PATH"
conda install -q -c conda-forge ciocheck
ciocheck spyder_unittest --disable-tests
- store_test_results:
path: test-reports
- store_artifacts:
path: test-reports
command: bash ./continuous_integration/circle/coverage.sh

jobs:
python2.7:
<<: *main
environment:
- PYTHON_VERSION: 2.7
- PYTHON_VERSION: "2.7"

python3.6:
<<: *main
environment:
- PYTHON_VERSION: 3.6
- PYTHON_VERSION: "3.6"

python3.7:
<<: *main
environment:
- PYTHON_VERSION: 3.7

- PYTHON_VERSION: "3.7"

workflows:
version: 2
Expand Down
53 changes: 0 additions & 53 deletions .travis.yml

This file was deleted.

64 changes: 0 additions & 64 deletions appveyor.yml

This file was deleted.

48 changes: 0 additions & 48 deletions conda.recipe/meta.yaml

This file was deleted.

7 changes: 7 additions & 0 deletions continuous_integration/circle/coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

export COVERALLS_REPO_TOKEN=c5Qt1n27dLFCAIESYVkuCmVpUU8doney1
source $HOME/miniconda/etc/profile.d/conda.sh
conda activate test

coveralls
34 changes: 34 additions & 0 deletions continuous_integration/circle/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash -ex

# -- Install Miniconda
MINICONDA=Miniconda3-latest-Linux-x86_64.sh
wget https://repo.continuum.io/miniconda/$MINICONDA -O miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
source $HOME/miniconda/etc/profile.d/conda.sh


# -- Make new conda environment with required Python version
conda create -y -n test python=$PYTHON_VERSION
conda activate test


# -- Install dependencies

# Avoid problems with invalid SSL certificates
if [ "$PYTHON_VERSION" = "2.7" ]; then
conda install -q -y python=2.7.16=h9bab390_0
fi

# Install nomkl to avoid installing Intel MKL libraries
conda install -q -y nomkl

# Install main dependencies
conda install -q -y -c spyder-ide --file requirements/conda.txt

# Install test ones
conda install -q -y -c spyder-ide --file requirements/tests.txt

# Install plugin itself
# (necessary because plugin starts python in different directories and expects
# to import the plugin; specifically, in test_run_tests_and_display_results)
pip install --no-deps -e .
7 changes: 7 additions & 0 deletions continuous_integration/circle/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

source $HOME/miniconda/etc/profile.d/conda.sh
conda activate test

# Run tests
pytest -x -vv --cov=spyder_unittest spyder_unittest
2 changes: 2 additions & 0 deletions requirements/conda.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lxml
spyder
7 changes: 7 additions & 0 deletions requirements/tests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
coveralls >=1.8
flaky
nose
pytest
pytest-cov
pytest-mock
pytest-qt
19 changes: 11 additions & 8 deletions spyder_unittest/tests/test_unittestplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

# Third party imports
import pytest
from spyder.plugins.projects.projecttypes import EmptyProject

# Local imports
from spyder_unittest.unittestplugin import UnitTestPlugin
Expand All @@ -18,10 +19,16 @@
from mock import Mock # Python 2


class PluginForTesting(UnitTestPlugin):
CONF_FILE = False

def __init__(self, parent):
UnitTestPlugin.__init__(self, parent)

@pytest.fixture
def plugin(qtbot):
"""Set up the unittest plugin."""
res = UnitTestPlugin(None)
res = PluginForTesting(None)
qtbot.addWidget(res)
res.main = Mock()
res.main.get_spyder_pythonpath = lambda: 'fakepythonpath'
Expand Down Expand Up @@ -70,9 +77,7 @@ def test_plugin_wdir(plugin, monkeypatch, tmpdir):
assert plugin.unittestwidget.default_wdir == 'fakecwd'

# Test after opening project, default_wdir is set to project dir
project = Mock()
project.CONF = {}
project.root_path = str(tmpdir)
project = EmptyProject(str(tmpdir))
plugin.main.projects.get_active_project = lambda: project
plugin.main.projects.get_active_project_path = lambda: project.root_path
plugin.handle_project_change()
Expand All @@ -87,14 +92,12 @@ def test_plugin_wdir(plugin, monkeypatch, tmpdir):

def test_plugin_config(plugin, tmpdir, qtbot):
# Test config file does not exist and config is empty
config_file_path = tmpdir.join('.spyproject', 'unittest.ini')
config_file_path = tmpdir.join('.spyproject', 'config', 'unittest.ini')
assert not config_file_path.check()
assert plugin.unittestwidget.config is None

# Open project
project = Mock()
project.CONF = {}
project.root_path = str(tmpdir)
project = EmptyProject(str(tmpdir))
plugin.main.projects.get_active_project = lambda: project
plugin.main.projects.get_active_project_path = lambda: project.root_path
plugin.handle_project_change()
Expand Down
Loading