Skip to content

Commit

Permalink
Merge from 5.x: PR #16492
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Sep 27, 2021
2 parents 4bbe538 + ff22dcb commit a184052
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 86 deletions.
46 changes: 18 additions & 28 deletions .github/scripts/install.sh
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
#!/bin/bash -ex

# Adjust PATH in macOS
if [ "$OS" = "macos" ]; then
# Adjust PATH in macOS because conda is not at front of it
PATH=/usr/local/miniconda/envs/test/bin:/usr/local/miniconda/condabin:$PATH
PATH=/Users/runner/miniconda3/envs/test/bin:/Users/runner/miniconda3/condabin:$PATH
fi

# Install dependencies
if [ "$USE_CONDA" = "true" ]; then

if [ "$OS" != "win" ]; then
# Install nomkl to avoid installing Intel MKL libraries
conda install nomkl -q -y
fi

# Install main dependencies
conda install python=$PYTHON_VERSION --file requirements/conda.txt -q -y -c spyder-ide/label/dev
mamba install python=$PYTHON_VERSION --file requirements/conda.txt -c conda-forge -q -y

# Install test ones
conda install python=$PYTHON_VERSION --file requirements/tests.txt -c spyder-ide -q -y
mamba install python=$PYTHON_VERSION --file requirements/tests.txt -c conda-forge -q -y

# Install Pyzmq 19 because our tests are failing with version 20
if [ "$OS" = "win" ]; then
conda install pyzmq=19
mamba install pyzmq=19
fi

# Constrain jupyter_client version on conda based tests
# The actual dependency constrain is done in spyder-kernels since v2.1.1
conda install jupyter_client=6
# To check our manifest and coverage
mamba install check-manifest codecov -c conda-forge -q -y

# Remove packages we have subrepos for.
conda remove spyder-kernels --force -q -y
Expand All @@ -51,11 +45,13 @@ else
# Install QtAwesome from Github
pip install git+https://github.com/spyder-ide/qtawesome.git

# To check our manifest and coverage
pip install -q check-manifest codecov

# Remove packages we have subrepos for
pip uninstall spyder-kernels -q -y
pip uninstall python-lsp-server -q -y
pip uninstall qdarkstyle -q -y

fi

# Install subrepos in development mode
Expand All @@ -71,31 +67,25 @@ pushd spyder/app/tests/spyder-boilerplate
pip install --no-deps -q -e .
popd

# Install Spyder to test it as if it was properly installed
# Install Spyder to test it as if it was properly installed.
# Note: `python setup.py egg_info` doesn't work here but it
# does locally.
pip uninstall spyder -q -y
python setup.py bdist_wheel
pip install --no-deps dist/spyder*.whl

# To check our manifest
pip install check-manifest
python setup.py -q bdist_wheel
pip install --no-deps -q dist/spyder*.whl

# Create environment for Jedi environments tests
conda create -n jedi-test-env -q -y python=3.6 flask spyder-kernels
conda list -n jedi-test-env
mamba create -n jedi-test-env -q -y python=3.6 flask spyder-kernels
mamba list -n jedi-test-env

# Create environment to test conda activation before launching a spyder kernel
conda create -n spytest-ž -q -y python=3.6 spyder-kernels
conda list -n spytest-ž
mamba create -n spytest-ž -q -y python=3.6 spyder-kernels
mamba list -n spytest-ž

# Install pyenv
# Install pyenv in Posix systems
if [ "$RUN_SLOW" = "false" ]; then
if [ "$OS" != "win" ]; then
curl https://pyenv.run | bash
$HOME/.pyenv/bin/pyenv install 3.8.1
fi
fi

# Coverage
pip install codecov
11 changes: 7 additions & 4 deletions .github/workflows/test-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
sudo apt-get update --fix-missing
sudo apt-get install libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev libxcb-shape0-dev libxcb-xkb-dev libegl1-mesa libxkbcommon-x11-0 xterm --fix-missing
- name: Cache conda
uses: actions/cache@v1
uses: actions/cache@v2
env:
# Increase this value to reset cache if requirements/*.txt has not changed
CACHE_NUMBER: 0
Expand All @@ -78,19 +78,22 @@ jobs:
key: ${{ runner.os }}-cacheconda-installconda-${{ matrix.PYTHON_VERSION }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements/*.txt') }}
- name: Cache pip
if: env.RUN_BUILD == 'true'
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-cachepip-installconda-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements/*.txt') }}
key: ${{ runner.os }}-cachepip-installconda-${{ env.CACHE_NUMBER }}-${{ hashFiles('setup.py') }}
- name: Install Conda
if: env.RUN_BUILD == 'true'
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test
auto-update-conda: true
auto-update-conda: false
auto-activate-base: false
python-version: ${{ matrix.PYTHON_VERSION }}
use-only-tar-bz2: true
channels: conda-forge,defaults
channel-priority: strict
miniforge-variant: Mambaforge
- name: Create test environment
if: env.RUN_BUILD == 'true'
shell: bash -l {0}
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
sudo apt-get update --fix-missing
sudo apt-get install libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev libxcb-shape0-dev libxcb-xkb-dev libegl1-mesa libxkbcommon-x11-0 xterm --fix-missing
- name: Cache conda
uses: actions/cache@v1
uses: actions/cache@v2
env:
# Increase this value to reset cache if requirements/*.txt has not changed
CACHE_NUMBER: 0
Expand All @@ -82,19 +82,22 @@ jobs:
key: ${{ runner.os }}-cacheconda-install${{ matrix.INSTALL_TYPE }}-${{ matrix.PYTHON_VERSION }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements/*.txt') }}
- name: Cache pip
if: env.RUN_BUILD == 'true'
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-cachepip-install${{ matrix.INSTALL_TYPE }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements/*.txt') }}
key: ${{ runner.os }}-cachepip-install${{ matrix.INSTALL_TYPE }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('setup.py') }}
- name: Install Conda
if: env.RUN_BUILD == 'true'
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test
auto-update-conda: true
auto-update-conda: false
auto-activate-base: false
python-version: ${{ matrix.PYTHON_VERSION }}
use-only-tar-bz2: true
channels: conda-forge,defaults
channel-priority: strict
miniforge-variant: Mambaforge
- name: Create test environment
if: env.RUN_BUILD == 'true'
shell: bash -l {0}
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/test-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
shell: bash -l {0}
run: echo "RUN_BUILD=true" >> $GITHUB_ENV
- name: Cache conda
uses: actions/cache@v1
uses: actions/cache@v2
env:
# Increase this value to reset cache if requirements/*.txt has not changed
CACHE_NUMBER: 0
Expand All @@ -75,19 +75,22 @@ jobs:
key: ${{ runner.os }}-cacheconda-install${{ matrix.INSTALL_TYPE }}-${{ matrix.PYTHON_VERSION }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements/*.txt') }}
- name: Cache pip
if: env.RUN_BUILD == 'true'
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/Library/Caches/pip
key: ${{ runner.os }}-cachepip-install${{ matrix.INSTALL_TYPE }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements/*.txt') }}
key: ${{ runner.os }}-cachepip-install${{ matrix.INSTALL_TYPE }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('setup.py') }}
- name: Install Conda
if: env.RUN_BUILD == 'true'
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test
auto-update-conda: true
auto-update-conda: false
auto-activate-base: false
python-version: ${{ matrix.PYTHON_VERSION }}
use-only-tar-bz2: true
channels: conda-forge,defaults
channel-priority: strict
miniforge-variant: Mambaforge
- name: Create test environment
if: env.RUN_BUILD == 'true'
shell: bash -l {0}
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/test-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
shell: bash -l {0}
run: echo "RUN_BUILD=true" >> $GITHUB_ENV
- name: Cache conda
uses: actions/cache@v1
uses: actions/cache@v2
env:
# Increase this value to reset cache if requirements/*.txt has not changed
CACHE_NUMBER: 0
Expand All @@ -75,19 +75,22 @@ jobs:
key: ${{ runner.os }}-cacheconda-install${{ matrix.INSTALL_TYPE }}-${{ matrix.PYTHON_VERSION }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements/*.txt') }}
- name: Cache pip
if: env.RUN_BUILD == 'true'
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-cachepip-install${{ matrix.INSTALL_TYPE }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements/*.txt') }}
key: ${{ runner.os }}-cachepip-install${{ matrix.INSTALL_TYPE }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('setup.py') }}
- name: Install Conda
if: env.RUN_BUILD == 'true'
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test
auto-update-conda: true
auto-update-conda: false
auto-activate-base: false
python-version: ${{ matrix.PYTHON_VERSION }}
use-only-tar-bz2: true
channels: conda-forge,defaults
channel-priority: strict
miniforge-variant: Mambaforge
- name: Create test environment
if: env.RUN_BUILD == 'true'
shell: bash -l {0}
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ $ workon spyder-dev
After you have created your development environment, you need to install Spyder's necessary dependencies. The easiest way to do so (with Anaconda) is

```bash
$ conda install -c spyder-ide/label/dev --file requirements/conda.txt
$ conda install -c conda-forge --file requirements/conda.txt
```

This installs all Spyder's dependencies into the environment.
Expand Down Expand Up @@ -99,7 +99,7 @@ $ python bootstrap.py --debug
To install our test dependencies under Anaconda:

```bash
$ conda install -c spyder-ide --file requirements/tests.txt
$ conda install -c conda-forge --file requirements/tests.txt
```

If using `pip` (for experts only), run the following from the directory where your git clone is stored:
Expand Down
8 changes: 2 additions & 6 deletions binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ dependencies:
- pyls-spyder >=0.4.0
- pyqt <5.13
- python-lsp-black >=1.0.0
# NOTE: There's no need to set constraints for python-lsp-server
# here because Spyder uses the subrepo for it when started in Binder.
- python-lsp-server
- python-lsp-server >=1.2.2,<1.3.0
- pyxdg >=0.26
- pyzmq >=17
- qdarkstyle =3.0.2
Expand All @@ -42,9 +40,7 @@ dependencies:
- rtree >=0.9.7
- setuptools >=49.6.0
- sphinx >=0.6.6
# NOTE: There's no need to set constraints for spyder-kernels here
# because Spyder uses the subrepo for it when started in Binder.
- spyder-kernels
- spyder-kernels >=2.1.1,<2.2.0
- textdistance >=4.2.0
- three-merge >=0.1.1
- watchdog >=0.10.3
Expand Down
8 changes: 2 additions & 6 deletions requirements/conda.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ pylint >=2.5.0,<2.10.0
pyls-spyder >=0.4.0
pyqt <5.13
python-lsp-black >=1.0.0
# There's no need to set a version for python-lsp-server
# because we install it from master for our tests.
python-lsp-server
python-lsp-server >=1.2.2,<1.3.0
pyxdg >=0.26
pyzmq >=17
qdarkstyle =3.0.2
Expand All @@ -38,9 +36,7 @@ qtpy >=1.5.0
rtree >=0.9.7
setuptools >=49.6.0
sphinx >=0.6.6
# NOTE: There's no need to set a version for spyder-kernels
# here because we're using a subrepo for it to run our tests.
spyder-kernels
spyder-kernels >=2.1.1,<2.2.0
textdistance >=4.2.0
three-merge >=0.1.1
watchdog >=0.10.3
1 change: 1 addition & 0 deletions spyder/app/tests/test_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3187,6 +3187,7 @@ def test_runcell_cache(main_window, qtbot, debug):

@pytest.mark.slow
@flaky(max_runs=3)
@pytest.mark.skipif(os.name == 'nt', reason="Fails on Windows")
def test_path_manager_updates_clients(qtbot, main_window, tmpdir):
"""Check that on path manager updates, consoles correctly update."""
main_window.show_path_manager()
Expand Down
3 changes: 2 additions & 1 deletion spyder/plugins/editor/widgets/tests/test_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ def test_move_multiple_lines_up(editor_bot):
assert editor.toPlainText() == expected_new_text


@pytest.mark.skipif(os.name == 'nt', reason="It fails on Windows")
@pytest.mark.skipif(not sys.platform.startswith('linux'),
reason="Works only on Linux")
def test_copy_lines_down_up(editor_bot, mocker, qtbot):
"""
Test that copy lines down and copy lines up are working as expected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import pytest

# Local imports
from spyder.config.base import running_in_ci
from spyder.plugins.editor.widgets import editor
from spyder.plugins.outlineexplorer.editor import OutlineExplorerProxyEditor
from spyder.plugins.outlineexplorer.main_widget import OutlineExplorerWidget
Expand Down Expand Up @@ -229,8 +230,7 @@ def test_sync_file_order(editorstack, outlineexplorer, test_files):


# ---- Test single file mode
@pytest.mark.skipif(not sys.platform == 'darwin',
reason="Fails on Linux and Windows")
@pytest.mark.skipif(running_in_ci(), reason="Fails on CIs")
def test_toggle_off_show_all_files(editorstack, outlineexplorer, test_files,
qtbot):
"""
Expand Down
6 changes: 6 additions & 0 deletions spyder/plugins/outlineexplorer/tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
# Standard Libray Imports
import json
import os.path as osp
import sys
from textwrap import dedent
from unittest.mock import MagicMock

# Third party imports
from flaky import flaky
import pytest
from qtpy.QtCore import Qt

Expand Down Expand Up @@ -201,6 +203,7 @@ def test_outline_explorer(case, create_outlineexplorer):
assert root_tree == expected_tree


@pytest.mark.skipif(sys.platform == 'darwin', reason="Fails on Mac")
def test_go_to_cursor_position(create_outlineexplorer, qtbot):
"""
Test that clicking on the 'Go to cursor position' button located in the
Expand All @@ -223,6 +226,7 @@ def test_go_to_cursor_position(create_outlineexplorer, qtbot):
assert outlineexplorer.treewidget.currentItem().text(0) == 'inner'


@flaky(max_runs=10)
def test_follow_cursor(create_outlineexplorer, qtbot):
"""
Test that the cursor is followed.
Expand All @@ -248,6 +252,7 @@ def test_follow_cursor(create_outlineexplorer, qtbot):
assert outlineexplorer.treewidget.currentItem().text(0) == 'b'


@flaky(max_runs=10)
def test_go_to_cursor_position_with_new_file(create_outlineexplorer, qtbot):
"""
Test that clicking on the 'Go to cursor position' button located in the
Expand All @@ -269,6 +274,7 @@ def test_go_to_cursor_position_with_new_file(create_outlineexplorer, qtbot):
assert outlineexplorer.treewidget.currentItem().text(0) == filename


@flaky(max_runs=10)
def test_go_to_last_item(create_outlineexplorer, qtbot):
"""
Test that clicking on the 'Go to cursor position' button located in the
Expand Down
Loading

0 comments on commit a184052

Please sign in to comment.