Skip to content

Commit

Permalink
fix: pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
hlouzada committed Oct 6, 2024
1 parent 525a049 commit 31441a0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
6 changes: 4 additions & 2 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def run_pytest(run_slow=False, extra_args=None, remoteclient=False):
pytest_args += extra_args

if remoteclient:
pytest_args += ['--container-scope=class' ,'./spyder/plugins/remoteclient']
pytest_args += ['--container-scope=class',
'./spyder/plugins/remoteclient']
os.environ["SPYDER_TEST_REMOTE_CLIENT"] = "true"
else:
pytest_args += ['--ignore=./spyder/plugins/remoteclient']
Expand All @@ -68,7 +69,8 @@ def run_pytest(run_slow=False, extra_args=None, remoteclient=False):
def main():
"""Parse args then run the pytest suite for Spyder."""
test_parser = argparse.ArgumentParser(
usage='python runtests.py [-h] [--run-slow] [--remote-client] [pytest_args]',
usage=('python runtests.py'
'[-h] [--run-slow] [--remote-client] [pytest_args]'),
description="Helper script to run Spyder's test suite")
test_parser.add_argument('--run-slow', action='store_true', default=False,
help='Run the slow tests')
Expand Down
3 changes: 0 additions & 3 deletions spyder/plugins/remoteclient/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from __future__ import annotations
from concurrent.futures import Future
import contextlib
import gc
import os
from pathlib import Path
Expand All @@ -26,10 +25,8 @@
from spyder.app.cli_options import get_options
from spyder.config.manager import CONF
from spyder.plugins.ipythonconsole.plugin import IPythonConsole
from spyder.plugins.remoteclient.api.client import SpyderRemoteClient
from spyder.plugins.remoteclient.plugin import RemoteClient
from spyder.plugins.remoteclient.widgets import AuthenticationMethod
from spyder.utils.qthelpers import qapplication


T = typing.TypeVar("T")
Expand Down
18 changes: 7 additions & 11 deletions spyder/plugins/remoteclient/tests/test_ipythonconsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"""IPython console and Spyder Remote Client integration tests."""

# Third party imports
import pytest
from flaky import flaky
import pytest

# Local imports
from spyder.plugins.remoteclient.tests.conftest import await_future
Expand Down Expand Up @@ -45,10 +45,6 @@ def test_restart_kernel(self, shell, ipyconsole, qtbot):
with qtbot.waitSignal(shell.executed):
shell.execute("a = 10")

# Restart kernel and wait until it's up again.
# NOTE: We trigger the restart_action instead of calling `restart_kernel`
# directly to also check that that action is working as expected and avoid
# regressions such as spyder-ide/spyder#22084.
shell._prompt_html = None
ipyconsole.get_widget().restart_action.trigger()
qtbot.waitUntil(
Expand Down Expand Up @@ -89,12 +85,12 @@ def test_kernel_kill(self, shell, qtbot):
"import os, signal; os.kill(os.getpid(), signal.SIGTERM)"
)

# Since the heartbeat and the tunnels are running in separate threads, we
# need to make sure that the heartbeat thread has "higher" priority than
# the tunnel thread, otherwise the kernel will be restarted and the tunnels
# recreated before the heartbeat can detect the kernel is dead.
# In the test enviroment, the heartbeat needs to be set to a lower value
# because there are fewer threads running.
# Since the heartbeat and the tunnels are running in separate threads,
# we need to make sure that the heartbeat thread has "higher" priority
# than the tunnel thread, otherwise the kernel will be restarted and
# the tunnels recreated before the heartbeat can detect the kernel
# is dead. In the test enviroment, the heartbeat needs to be set to a
# lower value because there are fewer threads running.
shell.kernel_handler.set_time_to_dead(0.2)

with qtbot.waitSignal(shell.sig_prompt_ready, timeout=30000):
Expand Down

0 comments on commit 31441a0

Please sign in to comment.