Skip to content

Commit

Permalink
Merge pull request #4835 from dalthviz/delete_print_test
Browse files Browse the repository at this point in the history
PR: Delete print test because it segfaults too frequently
  • Loading branch information
ccordoba12 authored Jul 28, 2017
2 parents f0e4d3e + 0bf8028 commit c95ea9e
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions spyder/app/tests/test_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import pytest
from qtpy import PYQT5, PYQT_VERSION
from qtpy.QtCore import Qt, QTimer
from qtpy.QtPrintSupport import QAbstractPrintDialog, QPrintDialog
from qtpy.QtTest import QTest
from qtpy.QtWidgets import QApplication, QFileDialog, QLineEdit

Expand Down Expand Up @@ -73,15 +72,6 @@ def open_file_in_editor(main_window, fname, directory=None):
QTest.keyClick(w, Qt.Key_Enter)


def print_file(main_window, result, selection_option=False):
"""Check if the print dialog has the correct option"""
top_level_widgets = QApplication.topLevelWidgets()
for w in top_level_widgets:
if isinstance(w, QPrintDialog):
result.append(selection_option == w.testOption(QAbstractPrintDialog.PrintSelection))
QTest.keyClick(w, Qt.Key_Escape)


def reset_run_code(qtbot, shell, code_editor, nsb):
"""Reset state after a run code test"""
with qtbot.waitSignal(shell.executed):
Expand Down Expand Up @@ -175,33 +165,6 @@ def test_calltip(main_window, qtbot):
main_window.editor.close_file()


@flaky(max_runs=3)
@pytest.mark.skipif(os.name == 'nt',
reason="QtWarningMsg: QPrintDialog: Cannot be used on non-native printer")
def test_print_file(main_window, qtbot, tmpdir):
"""Test print funtionality."""
# ---- Load test file ----
test_file = osp.join(LOCATION, 'script.py')
editor = main_window.editor
editor.load(test_file)
code_editor = editor.get_focus_widget()

# --- Test without selecting text ---
# Set a timer to manipulate the print dialog while it's running
result = []
QTimer.singleShot(2000, lambda: print_file(main_window, result))
editor.print_file()
assert True in result

# --- Test selecting text --
# Select all the text and set a timer to manipulate the print dialog while it's running
result = []
code_editor.selectAll()
QTimer.singleShot(2000, lambda: print_file(main_window, result, selection_option=True))
editor.print_file()
assert True in result


@flaky(max_runs=3)
def test_runconfig_workdir(main_window, qtbot, tmpdir):
"""Test runconfig workdir options."""
Expand Down

0 comments on commit c95ea9e

Please sign in to comment.