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: Delete print test because it segfaults too frequently #4835

Merged
merged 1 commit into from
Jul 28, 2017
Merged
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
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