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: Add missing PyQtWebEngine dependency for conda-forge based CI and fix tests #17860

Merged
merged 4 commits into from
May 12, 2022
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
11 changes: 1 addition & 10 deletions .github/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,9 @@ if [ "$USE_CONDA" = "true" ]; then
fi
done

# Install jupyter_client 7.2.0 to prevent ZMQ Socket operation on non-socket
# Remove this when the issue is fixed upstream most probaly with jupyter_client=7.2.3
# See https://github.com/spyder-ide/spyder/issues/17615
mamba install jupyter_client=7.2.0 -c conda-forge -q -y
else
# Update pip and setuptools
pip install -U pip setuptools
python -m pip install -U pip setuptools

# Install Spyder and its dependencies from our setup.py
pip install -e .[test]
Expand All @@ -61,11 +57,6 @@ else
pip uninstall $dep -q -y
done

# Install jupyter_client 7.2.0 to prevent ZMQ Socket operation on non-socket
# Remove this when the issue is fixed upstream most probaly with jupyter_client=7.2.3
# See https://github.com/spyder-ide/spyder/issues/17615
pip install -q jupyter_client==7.2.0

# Remove Spyder to properly install it below
pip uninstall spyder -q -y
fi
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
shell: bash
run: |
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
sudo apt-get install -qq pyqt5-dev-tools libxcb-xinerama0 xterm --fix-missing
- name: Cache conda
uses: actions/cache@v2
env:
Expand Down
1 change: 1 addition & 0 deletions binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ dependencies:
- pylint >=2.5.0
- pyls-spyder >=0.4.0
- pyqt <5.16
- pyqtwebengine <5.16
- python-lsp-black >=1.2.0
- python-lsp-server >=1.4.1,<1.5.0
- pyxdg >=0.26
Expand Down
1 change: 1 addition & 0 deletions requirements/conda.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pygments >=2.0
pylint >=2.5.0
pyls-spyder >=0.4.0
pyqt <5.16
pyqtwebengine <5.16
python-lsp-black >=1.2.0
python-lsp-server >=1.4.1,<1.5.0
pyxdg >=0.26
Expand Down
3 changes: 2 additions & 1 deletion spyder/plugins/variableexplorer/widgets/dataframeeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,6 @@ def resize_to_contents(self):
#==============================================================================
def test_edit(data, title="", parent=None):
"""Test subroutine"""
app = qapplication() # analysis:ignore
dlg = DataFrameEditor(parent=parent)

if dlg.setup_and_check(data, title=title):
Expand All @@ -1384,6 +1383,8 @@ def test():
from numpy import nan
from pandas.util.testing import assert_frame_equal, assert_series_equal

app = qapplication() # analysis:ignore

df1 = pd.DataFrame(
[
[True, "bool"],
Expand Down
20 changes: 10 additions & 10 deletions spyder/plugins/variableexplorer/widgets/objecteditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def end_func(dialog):
return dialog, end_func


def oedit(obj, modal=True, namespace=None):
def oedit(obj, modal=True, namespace=None, app=None):
"""Edit the object 'obj' in a GUI-based editor and return the edited copy
(if Cancel is pressed, return None)

Expand All @@ -110,10 +110,6 @@ def oedit(obj, modal=True, namespace=None):
(instantiate a new QApplication if necessary,
so it can be called directly from the interpreter)
"""
# Local import
from spyder.utils.qthelpers import qapplication
app = qapplication()

if modal:
obj_name = ''
else:
Expand All @@ -137,7 +133,7 @@ def oedit(obj, modal=True, namespace=None):
else:
keeper.create_dialog(dialog, obj_name, end_func)
import os
if os.name == 'nt':
if os.name == 'nt' and app:
app.exec_()


Expand All @@ -146,6 +142,10 @@ def oedit(obj, modal=True, namespace=None):
#==============================================================================
def test():
"""Run object editor test"""
# Local import
from spyder.utils.qthelpers import qapplication
app = qapplication() # analysis:ignore

data = np.random.randint(1, 256, size=(100, 100)).astype('uint8')
image = PIL.Image.fromarray(data)
example = {'str': 'kjkj kj k j j kj k jkj',
Expand All @@ -164,10 +164,10 @@ def __init__(self):
self.text = "toto"
foobar = Foobar()

print(oedit(foobar)) # spyder: test-skip
print(oedit(example)) # spyder: test-skip
print(oedit(np.random.rand(10, 10))) # spyder: test-skip
print(oedit(oedit.__doc__)) # spyder: test-skip
print(oedit(foobar, app=app)) # spyder: test-skip
print(oedit(example, app=app)) # spyder: test-skip
print(oedit(np.random.rand(10, 10), app=app)) # spyder: test-skip
print(oedit(oedit.__doc__, app=app)) # spyder: test-skip
print(example) # spyder: test-skip


Expand Down
5 changes: 2 additions & 3 deletions spyder/tests/test_dependencies_in_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ def test_dependencies_for_spyder_dialog_in_sync():

if 'pyqt' in spyder_reqs:
spyder_reqs.pop('pyqt')
if 'pyqtwebengine' in spyder_reqs:
spyder_reqs.pop('pyqtwebengine')

assert spyder_deps == spyder_reqs

Expand All @@ -231,9 +233,6 @@ def test_dependencies_for_spyder_setup_install_requires_in_sync():
spyder_setup = parse_setup_install_requires(SETUP_FPATH)
spyder_reqs = parse_requirements(REQ_FPATH)

if 'pyqtwebengine' in spyder_setup:
spyder_setup.pop('pyqtwebengine')

assert spyder_setup == spyder_reqs


Expand Down
12 changes: 4 additions & 8 deletions spyder/widgets/collectionseditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1785,20 +1785,13 @@ def __init__(self):

def editor_test():
"""Test Collections editor."""
from spyder.utils.qthelpers import qapplication

app = qapplication() #analysis:ignore
dialog = CollectionsEditor()
dialog.setup(get_test_data())
dialog.show()
app.exec_()


def remote_editor_test():
"""Test remote collections editor."""
from spyder.utils.qthelpers import qapplication
app = qapplication()

from spyder.config.manager import CONF
from spyder_kernels.utils.nsview import (make_remote_view,
REMOTE_SETTINGS)
Expand All @@ -1811,9 +1804,12 @@ def remote_editor_test():
dialog = CollectionsEditor()
dialog.setup(remote, remote=True)
dialog.show()
app.exec_()


if __name__ == "__main__":
from spyder.utils.qthelpers import qapplication

app = qapplication() # analysis:ignore
editor_test()
remote_editor_test()
app.exec_()