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: Fix more type errors in Python 3.10 and also tests #17256

Merged
merged 3 commits into from
Jan 30, 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
8 changes: 8 additions & 0 deletions .github/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ if [ "$USE_CONDA" = "true" ]; then
conda remove spyder-kernels --force -q -y
conda remove python-lsp-server --force -q -y
conda remove qdarkstyle --force -q -y

# Install an older version of black until we fix pylsp-black to
# work with 22.1.0
mamba install black=21
else
# Update pip and setuptools
pip install -U pip setuptools
Expand Down Expand Up @@ -55,6 +59,10 @@ else

# Remove Spyder to properly install it below
pip uninstall spyder -q -y

# Install an older version of black until we fix pylsp-black to
# work with 22.1.0
pip install black==21.12b0
fi

# Install subrepos in development mode
Expand Down
4 changes: 4 additions & 0 deletions installers/Windows/req-extras-pull-request.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ sympy

# There are no wheels for version 3.3
cryptography==3.2.1

# Workaround for black 22 until we release a new version of
# pylsp-black
black==21.12b0
1 change: 1 addition & 0 deletions installers/macOS/req-extras.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Spyder extra packages
autopep8
black==21.12b0 # App fails with version 22
flake8
Paramiko
pycodestyle
Expand Down
2 changes: 1 addition & 1 deletion spyder/plugins/editor/panels/linenumber.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def draw_linenumbers(self, painter):

# Hide non-bold number
painter.fillRect(
left, active_top, size.width(), size.height(),
int(left), active_top, int(size.width()), int(size.height()),
self.editor.sideareas_color
)

Expand Down
18 changes: 13 additions & 5 deletions spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ def test_get_calltips(ipyconsole, qtbot, function, signature, documentation):

@flaky(max_runs=3)
@pytest.mark.auto_backend
@pytest.mark.skipif(
running_in_ci() and not os.name == 'nt',
reason="Times out on Linux and macOS")
def test_auto_backend(ipyconsole, qtbot):
"""Test that the automatic backend was set correctly."""
# Wait until the window is fully up
Expand Down Expand Up @@ -1839,14 +1842,16 @@ def test_startup_code_pdb(ipyconsole, qtbot):
@flaky(max_runs=3)
@pytest.mark.parametrize(
"backend",
['inline', 'qt5', 'tk', 'osx', ]
['inline', 'qt5', 'tk', 'osx']
)
def test_pdb_eventloop(ipyconsole, qtbot, backend):
"""Check if pdb works with every backend. (only testing 3)."""
"""Check if setting an event loop while debugging works."""
# Skip failing tests
if backend == 'tk' and (os.name == 'nt' or PY2):
if backend == 'tk' and os.name == 'nt':
return
if backend == 'osx' and sys.platform != "darwin":
return
if backend == 'osx' and (sys.platform != "darwin" or PY2):
if backend == 'qt5' and not os.name == "nt" and running_in_ci():
return

shell = ipyconsole.get_current_shellwidget()
Expand Down Expand Up @@ -2057,7 +2062,10 @@ def test_breakpoint_builtin(ipyconsole, qtbot, tmpdir):

@flaky(max_runs=3)
@pytest.mark.auto_backend
def test_shutdown_kernel(ipyconsole, qtbot, tmpdir):
@pytest.mark.skipif(
running_in_ci() and not os.name == 'nt',
reason="Times out on Linux and macOS")
def test_shutdown_kernel(ipyconsole, qtbot):
"""
Check that the kernel is shutdown after creating plots with the
automatic backend.
Expand Down
2 changes: 1 addition & 1 deletion spyder/plugins/onlinehelp/tests/test_pydocgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def pydocbrowser(qtbot):
widget.resize(640, 480)
widget.show()

with qtbot.waitSignal(widget.sig_load_finished, timeout=6000):
with qtbot.waitSignal(widget.sig_load_finished, timeout=20000):
widget.initialize()

qtbot.addWidget(widget)
Expand Down
8 changes: 4 additions & 4 deletions spyder/widgets/calltip.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ def show_tip(self, point, tip, cursor=None, completion_doc=None):
if os.name == 'nt':
padding = -7
else:
padding = -4.5
point.setY(int(adjusted_point.y() - tip_height - padding))
padding = -4
point.setY(adjusted_point.y() - tip_height - padding)

if horizontal == 'Left':
point.setX(adjusted_point.x() - tip_width - padding)
Expand Down Expand Up @@ -500,9 +500,9 @@ def show_tip(self, point, tip, wrapped_tiplines):
if os.name == 'nt':
padding = -7
else:
padding = -4.5

padding = -4
point.setY(adjusted_point.y() - tip_height - padding)

if horizontal == 'Left':
point.setX(adjusted_point.x() - tip_width - padding)

Expand Down