Skip tests which need sys.executable when frozen.

See #770
This commit is contained in:
Florian Bruhin 2015-06-18 22:36:12 +02:00
parent b0012fd410
commit 08c8a5f7dd
2 changed files with 11 additions and 1 deletions

View File

@ -33,6 +33,10 @@ from qutebrowser.misc import guiprocess
# FIXME check statusbar messages
no_frozen = pytest.mark.skipif(
getattr(sys, 'frozen', False), reason="Can't be executed when frozen.")
def _py_proc(code):
"""Get a python executable and args list which executes the given code."""
return (sys.executable, ['-c', textwrap.dedent(code.strip('\n'))])
@ -64,6 +68,7 @@ def fake_proc(monkeypatch, stubs):
return p
@no_frozen
def test_start(proc, qtbot):
"""Test simply starting a process."""
with qtbot.waitSignals([proc.started, proc.finished], raising=True,
@ -75,7 +80,7 @@ def test_start(proc, qtbot):
@pytest.mark.parametrize('argv', [
_py_proc('import sys; sys.exit(0)'),
no_frozen(_py_proc('import sys; sys.exit(0)')),
('does_not', 'exist'),
])
def test_start_detached(fake_proc, argv):
@ -85,6 +90,7 @@ def test_start_detached(fake_proc, argv):
fake_proc._proc.startDetached.assert_called_with(*list(argv) + [None])
@no_frozen
def test_double_start(qtbot, proc):
"""Test starting a GUIProcess twice."""
with qtbot.waitSignal(proc.started, raising=True, timeout=2000):
@ -94,6 +100,7 @@ def test_double_start(qtbot, proc):
proc.start('', [])
@no_frozen
def test_double_start_finished(qtbot, proc):
"""Test starting a GUIProcess twice (with the first call finished)."""
with qtbot.waitSignals([proc.started, proc.finished], raising=True,
@ -120,6 +127,7 @@ def test_error(qtbot, proc):
proc.start('this_does_not_exist_either', [])
@no_frozen
def test_exit_unsuccessful(qtbot, proc):
with qtbot.waitSignal(proc.finished, raising=True, timeout=2000):
proc.start(*_py_proc('import sys; sys.exit(0)'))

View File

@ -757,6 +757,8 @@ class TestPyQIODevice:
with pytest.raises(io.UnsupportedOperation):
pyqiodev.seek(0, whence)
@pytest.mark.skipif(getattr(sys, 'frozen', False),
reason="Can't be executed when frozen.")
def test_qprocess(self):
"""Test PyQIODevice with a QProcess which is non-sequential.