Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
dalthviz committed Feb 7, 2022
1 parent ce96368 commit ff90388
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
9 changes: 5 additions & 4 deletions spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,8 @@ def test_remove_old_std_files(ipyconsole, qtbot):

@flaky(max_runs=10)
@pytest.mark.use_startup_wdir
@pytest.mark.skipif(os.name == 'nt', reason="Too flaky on Windows")
@pytest.mark.skipif(sys.platform.startswith('linux'),
reason="Too flaky on Linux")
def test_console_working_directory(ipyconsole, qtbot):
"""Test for checking the working directory."""
shell = ipyconsole.get_current_shellwidget()
Expand Down Expand Up @@ -1965,11 +1966,10 @@ def test_stop_pdb(ipyconsole, qtbot):


@flaky(max_runs=3)
@pytest.mark.skipif(sys.platform == 'nt', reason="Times out on Windows")
def test_code_cache(ipyconsole, qtbot):
"""
Test that code sent to execute is properly cached
and that the cache is empited on interrupt.
and that the cache is emptied on interrupt.
"""
shell = ipyconsole.get_current_shellwidget()
qtbot.waitUntil(lambda: shell._prompt_html is not None,
Expand All @@ -1987,7 +1987,8 @@ def check_value(name, value):

# Send two execute requests and make sure the second one is executed
shell.execute('import time; time.sleep(.5)')
shell.execute('var = 142')
with qtbot.waitSignal(shell.executed):
shell.execute('var = 142')
qtbot.wait(500)
qtbot.waitUntil(lambda: check_value('var', 142))
assert shell.get_value('var') == 142
Expand Down
9 changes: 4 additions & 5 deletions spyder/plugins/ipythonconsole/widgets/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,16 @@ def shutdown(self, shutdown_kernel=True):
self.shutting_down = True
if shutdown_kernel:
self.interrupt_kernel()
self.spyder_kernel_comm.close()
self.kernel_manager.stop_restarter()
self.spyder_kernel_comm.close()
if self.kernel_client is not None:
self.kernel_client.stop_channels()

shutdown_thread = QThread(self)
shutdown_thread.kernel_manager = self.kernel_manager
shutdown_thread.run = self.shutdown_kernel
if self.kernel_client is not None:
shutdown_thread.finished.connect(
self.kernel_client.stop_channels)
shutdown_thread.start()
self.shutdown_thread_list.append(shutdown_thread)
shutdown_thread.start()
else:
self.spyder_kernel_comm.close(shutdown_channel=False)
if self.kernel_client is not None:
Expand Down
2 changes: 2 additions & 0 deletions spyder/plugins/projects/utils/watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class WorkspaceWatcher(QObject):
"""

observer = None

def __init__(self, parent=None):
super().__init__(parent)
self.event_handler = WorkspaceEventHandler(self)
Expand Down Expand Up @@ -165,5 +166,6 @@ def stop(self):
self.observer.stop()
self.observer.join()
del self.observer
self.observer = None
except RuntimeError:
pass

0 comments on commit ff90388

Please sign in to comment.