diff --git a/tests/integration/quteprocess.py b/tests/integration/quteprocess.py index 74d3487b0..3aba8e235 100644 --- a/tests/integration/quteprocess.py +++ b/tests/integration/quteprocess.py @@ -207,10 +207,11 @@ class QuteProc(testprocess.Process): else: executable = sys.executable args = ['-m', 'qutebrowser'] - args += ['--debug', '--no-err-windows', '--temp-basedir', - 'about:blank'] return executable, args + def _default_args(self): + return ['--debug', '--no-err-windows', '--temp-basedir', 'about:blank'] + def path_to_url(self, path, *, port=None, https=False): """Get a URL based on a filename for the localhost webserver. diff --git a/tests/integration/test_testprocess.py b/tests/integration/test_testprocess.py index 4c9a259d3..92608a4d8 100644 --- a/tests/integration/test_testprocess.py +++ b/tests/integration/test_testprocess.py @@ -73,6 +73,9 @@ class PythonProcess(testprocess.Process): ] return (sys.executable, ['-c', ';'.join(code)]) + def _default_args(self): + return [] + class QuitPythonProcess(testprocess.Process): @@ -96,6 +99,9 @@ class QuitPythonProcess(testprocess.Process): ] return (sys.executable, ['-c', ';'.join(code)]) + def _default_args(self): + return [] + @pytest.yield_fixture def pyproc(): diff --git a/tests/integration/testprocess.py b/tests/integration/testprocess.py index 75972ab3f..79fb5494d 100644 --- a/tests/integration/testprocess.py +++ b/tests/integration/testprocess.py @@ -159,7 +159,11 @@ class Process(QObject): raise NotImplementedError def _executable_args(self): - """Get the executable and arguments to pass to it as a tuple.""" + """Get the executable and necessary arguments as a tuple.""" + raise NotImplementedError + + def _default_args(self): + """Get the default arguments to use if none were passed to start().""" raise NotImplementedError def _get_data(self): @@ -208,16 +212,18 @@ class Process(QObject): self._data.append(parsed) self.new_data.emit(parsed) - def start(self): + def start(self, args=None): """Start the process and wait until it started.""" with self._wait_signal(self.ready, timeout=60000): - self._start() + self._start(args) - def _start(self): + def _start(self, args): """Actually start the process.""" - executable, args = self._executable_args() + executable, exec_args = self._executable_args() + if args is None: + args = self._default_args() self.proc.readyRead.connect(self.read_log) - self.proc.start(executable, args) + self.proc.start(executable, exec_args + args) ok = self.proc.waitForStarted() assert ok assert self.is_running() diff --git a/tests/integration/webserver.py b/tests/integration/webserver.py index d9dd40be3..0cae0c603 100644 --- a/tests/integration/webserver.py +++ b/tests/integration/webserver.py @@ -154,14 +154,17 @@ class WebserverProcess(testprocess.Process): if hasattr(sys, 'frozen'): executable = os.path.join(os.path.dirname(sys.executable), self._script) - args = [str(self.port)] + args = [] else: executable = sys.executable py_file = os.path.join(os.path.dirname(__file__), self._script + '.py') - args = [py_file, str(self.port)] + args = [py_file] return executable, args + def _default_args(self): + return [str(self.port)] + def cleanup(self): """Clean up and shut down the process.""" self.proc.terminate()