Change quteproc._request back to quteproc.request

Otherwise our per-test quteproc fixture wouldn't set the 'request'
object properly from the outside, and quteproc always had a module as
request.node.
This commit is contained in:
Florian Bruhin 2016-08-19 13:05:59 +02:00
parent 8378e16139
commit 362c23692a
2 changed files with 8 additions and 8 deletions

View File

@ -143,7 +143,7 @@ class QuteProc(testprocess.Process):
_ipc_socket: The IPC socket of the started instance. _ipc_socket: The IPC socket of the started instance.
_webengine: Whether to use QtWebEngine _webengine: Whether to use QtWebEngine
basedir: The base directory for this instance. basedir: The base directory for this instance.
_request: The request object for the current test. request: The request object for the current test.
_focus_ready: Whether the main window got focused. _focus_ready: Whether the main window got focused.
_load_ready: Whether the about:blank page got loaded. _load_ready: Whether the about:blank page got loaded.
_instance_id: A unique ID for this QuteProc instance _instance_id: A unique ID for this QuteProc instance
@ -167,7 +167,7 @@ class QuteProc(testprocess.Process):
self._load_ready = False self._load_ready = False
self._instance_id = next(instance_counter) self._instance_id = next(instance_counter)
self._run_counter = itertools.count() self._run_counter = itertools.count()
self._request = request self.request = request
def _is_ready(self, what): def _is_ready(self, what):
"""Called by _parse_line if loading/focusing is done. """Called by _parse_line if loading/focusing is done.
@ -197,7 +197,7 @@ class QuteProc(testprocess.Process):
else: else:
raise raise
log_line.use_color = self._request.config.getoption('--color') != 'no' log_line.use_color = self.request.config.getoption('--color') != 'no'
self._log(log_line) self._log(log_line)
start_okay_message_load = ( start_okay_message_load = (
@ -237,7 +237,7 @@ class QuteProc(testprocess.Process):
return log_line return log_line
def _executable_args(self): def _executable_args(self):
profile = self._request.config.getoption('--qute-profile-subprocs') profile = self.request.config.getoption('--qute-profile-subprocs')
if hasattr(sys, 'frozen'): if hasattr(sys, 'frozen'):
if profile: if profile:
raise Exception("Can't profile with sys.frozen!") raise Exception("Can't profile with sys.frozen!")
@ -277,7 +277,7 @@ class QuteProc(testprocess.Process):
if path.startswith('about:') or path.startswith('qute:'): if path.startswith('about:') or path.startswith('qute:'):
return path return path
else: else:
httpbin = self._request.getfuncargvalue('httpbin') httpbin = self.request.getfuncargvalue('httpbin')
return '{}://localhost:{}/{}'.format( return '{}://localhost:{}/{}'.format(
'https' if https else 'http', 'https' if https else 'http',
httpbin.port if port is None else port, httpbin.port if port is None else port,
@ -343,7 +343,7 @@ class QuteProc(testprocess.Process):
if self._is_error_logline(msg) and not msg.expected] if self._is_error_logline(msg) and not msg.expected]
try: try:
call = self._request.node.rep_call call = self.request.node.rep_call
except AttributeError: except AttributeError:
pass pass
else: else:
@ -365,7 +365,7 @@ class QuteProc(testprocess.Process):
def send_ipc(self, commands, target_arg=''): def send_ipc(self, commands, target_arg=''):
"""Send a raw command to the running IPC socket.""" """Send a raw command to the running IPC socket."""
delay = self._request.config.getoption('--qute-delay') delay = self.request.config.getoption('--qute-delay')
time.sleep(delay / 1000) time.sleep(delay / 1000)
assert self._ipc_socket is not None assert self._ipc_socket is not None

View File

@ -73,7 +73,7 @@ def request_mock(quteproc, monkeypatch, httpbin):
fake_node = collections.namedtuple('FakeNode', ['rep_call'])(fake_call) fake_node = collections.namedtuple('FakeNode', ['rep_call'])(fake_call)
fake_request = FakeRequest(fake_node, fake_config, httpbin) fake_request = FakeRequest(fake_node, fake_config, httpbin)
assert not hasattr(fake_request.node.rep_call, 'wasxfail') assert not hasattr(fake_request.node.rep_call, 'wasxfail')
monkeypatch.setattr(quteproc, '_request', fake_request) monkeypatch.setattr(quteproc, 'request', fake_request)
return fake_request return fake_request