bdd tests: Restart qutebrowser once per module.
This should be a good compromise between reproducibility and speed.
This commit is contained in:
parent
f5eb755ef3
commit
535bcab310
@ -34,7 +34,7 @@ def set_setting(quteproc, sect, opt, value):
|
|||||||
|
|
||||||
|
|
||||||
@bdd.given(bdd.parsers.parse("I open {path}"))
|
@bdd.given(bdd.parsers.parse("I open {path}"))
|
||||||
def open_path(quteproc, path):
|
def open_path_given(quteproc, path):
|
||||||
quteproc.open_path(path, new_tab=True)
|
quteproc.open_path(path, new_tab=True)
|
||||||
|
|
||||||
|
|
||||||
@ -43,8 +43,13 @@ def open_path_when(quteproc, path):
|
|||||||
quteproc.open_path(path)
|
quteproc.open_path(path)
|
||||||
|
|
||||||
|
|
||||||
|
@bdd.given(bdd.parsers.parse("I run {command}"))
|
||||||
|
def run_command_given(quteproc, command):
|
||||||
|
quteproc.send_cmd(command)
|
||||||
|
|
||||||
|
|
||||||
@bdd.when(bdd.parsers.parse("I run {command}"))
|
@bdd.when(bdd.parsers.parse("I run {command}"))
|
||||||
def run_command(quteproc, command):
|
def run_command_when(quteproc, command):
|
||||||
quteproc.send_cmd(command)
|
quteproc.send_cmd(command)
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ Feature: Zooming in and out
|
|||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given I open data/hello.txt
|
Given I open data/hello.txt
|
||||||
|
And I run :tab-only
|
||||||
|
|
||||||
Scenario: Zooming in
|
Scenario: Zooming in
|
||||||
When I run :zoom-in
|
When I run :zoom-in
|
||||||
@ -9,7 +10,6 @@ Feature: Zooming in and out
|
|||||||
And the session should look like:
|
And the session should look like:
|
||||||
windows:
|
windows:
|
||||||
- tabs:
|
- tabs:
|
||||||
- ...
|
|
||||||
- history:
|
- history:
|
||||||
- zoom: 1.1
|
- zoom: 1.1
|
||||||
|
|
||||||
@ -19,7 +19,6 @@ Feature: Zooming in and out
|
|||||||
And the session should look like:
|
And the session should look like:
|
||||||
windows:
|
windows:
|
||||||
- tabs:
|
- tabs:
|
||||||
- ...
|
|
||||||
- history:
|
- history:
|
||||||
- zoom: 0.9
|
- zoom: 0.9
|
||||||
|
|
||||||
@ -29,7 +28,6 @@ Feature: Zooming in and out
|
|||||||
And the session should look like:
|
And the session should look like:
|
||||||
windows:
|
windows:
|
||||||
- tabs:
|
- tabs:
|
||||||
- ...
|
|
||||||
- history:
|
- history:
|
||||||
- zoom: 0.5
|
- zoom: 0.5
|
||||||
|
|
||||||
@ -40,6 +38,5 @@ Feature: Zooming in and out
|
|||||||
And the session should look like:
|
And the session should look like:
|
||||||
windows:
|
windows:
|
||||||
- tabs:
|
- tabs:
|
||||||
- ...
|
|
||||||
- history:
|
- history:
|
||||||
- zoom: 1.0
|
- zoom: 1.0
|
||||||
|
@ -223,11 +223,17 @@ class QuteProc(testprocess.Process):
|
|||||||
line.expected = True
|
line.expected = True
|
||||||
|
|
||||||
|
|
||||||
@pytest.yield_fixture
|
@pytest.yield_fixture(scope='module')
|
||||||
def quteproc(qapp, httpbin):
|
def quteproc(qapp, httpbin):
|
||||||
"""Fixture for qutebrowser process."""
|
"""Fixture for qutebrowser process."""
|
||||||
proc = QuteProc(httpbin)
|
proc = QuteProc(httpbin)
|
||||||
proc.start()
|
proc.start()
|
||||||
yield proc
|
yield proc
|
||||||
proc.terminate()
|
proc.terminate()
|
||||||
proc.after_test()
|
|
||||||
|
|
||||||
|
@pytest.yield_fixture(autouse=True)
|
||||||
|
def httpbin_after_test(quteproc):
|
||||||
|
"""Fixture to run cleanup tasks after each test."""
|
||||||
|
yield
|
||||||
|
quteproc.after_test()
|
||||||
|
@ -145,11 +145,11 @@ class Process(QObject):
|
|||||||
self._data.clear()
|
self._data.clear()
|
||||||
if self._invalid:
|
if self._invalid:
|
||||||
raise InvalidLine
|
raise InvalidLine
|
||||||
|
if not self.is_running():
|
||||||
|
raise ProcessExited
|
||||||
|
|
||||||
def terminate(self):
|
def terminate(self):
|
||||||
"""Clean up and shut down the process."""
|
"""Clean up and shut down the process."""
|
||||||
if not self.is_running():
|
|
||||||
raise ProcessExited
|
|
||||||
self.proc.terminate()
|
self.proc.terminate()
|
||||||
self.proc.waitForFinished()
|
self.proc.waitForFinished()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user