Merge branch 'HolySmoke86-issue1947'
This commit is contained in:
commit
d07a488c9b
@ -135,6 +135,7 @@ Changed
|
|||||||
* `fonts -> messages.warning`
|
* `fonts -> messages.warning`
|
||||||
* `fonts -> messages.info`
|
* `fonts -> messages.info`
|
||||||
- The `qute:settings` page now also shows option descriptions.
|
- The `qute:settings` page now also shows option descriptions.
|
||||||
|
- `qute:version` and `qutebrowser --version` now show various important paths
|
||||||
|
|
||||||
Deprecated
|
Deprecated
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
@ -174,6 +174,7 @@ Contributors, sorted by the number of commits in descending order:
|
|||||||
* ZDarian
|
* ZDarian
|
||||||
* Milan Svoboda
|
* Milan Svoboda
|
||||||
* John ShaggyTwoDope Jenkins
|
* John ShaggyTwoDope Jenkins
|
||||||
|
* Daniel Karbach
|
||||||
* Clayton Craft
|
* Clayton Craft
|
||||||
* Peter Vilim
|
* Peter Vilim
|
||||||
* knaggita
|
* knaggita
|
||||||
@ -259,7 +260,6 @@ Contributors, sorted by the number of commits in descending order:
|
|||||||
* Dietrich Daroch
|
* Dietrich Daroch
|
||||||
* Derek Sivers
|
* Derek Sivers
|
||||||
* Daniel Lu
|
* Daniel Lu
|
||||||
* Daniel Karbach
|
|
||||||
* Arseniy Seroka
|
* Arseniy Seroka
|
||||||
* Andy Balaam
|
* Andy Balaam
|
||||||
* Andreas Fischer
|
* Andreas Fischer
|
||||||
|
@ -62,10 +62,6 @@ qApp = None
|
|||||||
|
|
||||||
def run(args):
|
def run(args):
|
||||||
"""Initialize everything and run the application."""
|
"""Initialize everything and run the application."""
|
||||||
if args.version:
|
|
||||||
print(version.version())
|
|
||||||
sys.exit(usertypes.Exit.ok)
|
|
||||||
|
|
||||||
if args.temp_basedir:
|
if args.temp_basedir:
|
||||||
args.basedir = tempfile.mkdtemp(prefix='qutebrowser-basedir-')
|
args.basedir = tempfile.mkdtemp(prefix='qutebrowser-basedir-')
|
||||||
|
|
||||||
@ -79,6 +75,13 @@ def run(args):
|
|||||||
qApp.setApplicationVersion(qutebrowser.__version__)
|
qApp.setApplicationVersion(qutebrowser.__version__)
|
||||||
qApp.lastWindowClosed.connect(quitter.on_last_window_closed)
|
qApp.lastWindowClosed.connect(quitter.on_last_window_closed)
|
||||||
|
|
||||||
|
log.init.debug("Initializing directories...")
|
||||||
|
standarddir.init(args)
|
||||||
|
|
||||||
|
if args.version:
|
||||||
|
print(version.version())
|
||||||
|
sys.exit(usertypes.Exit.ok)
|
||||||
|
|
||||||
crash_handler = crashsignal.CrashHandler(
|
crash_handler = crashsignal.CrashHandler(
|
||||||
app=qApp, quitter=quitter, args=args, parent=qApp)
|
app=qApp, quitter=quitter, args=args, parent=qApp)
|
||||||
crash_handler.activate()
|
crash_handler.activate()
|
||||||
@ -378,9 +381,6 @@ def _init_modules(args, crash_handler):
|
|||||||
readline_bridge = readline.ReadlineBridge()
|
readline_bridge = readline.ReadlineBridge()
|
||||||
objreg.register('readline-bridge', readline_bridge)
|
objreg.register('readline-bridge', readline_bridge)
|
||||||
|
|
||||||
log.init.debug("Initializing directories...")
|
|
||||||
standarddir.init(args)
|
|
||||||
|
|
||||||
log.init.debug("Initializing config...")
|
log.init.debug("Initializing config...")
|
||||||
config.init(qApp)
|
config.init(qApp)
|
||||||
save_manager.init_autosave()
|
save_manager.init_autosave()
|
||||||
|
@ -38,7 +38,7 @@ except ImportError: # pragma: no cover
|
|||||||
qWebKitVersion = None
|
qWebKitVersion = None
|
||||||
|
|
||||||
import qutebrowser
|
import qutebrowser
|
||||||
from qutebrowser.utils import log, utils
|
from qutebrowser.utils import log, utils, standarddir
|
||||||
from qutebrowser.browser import pdfjs
|
from qutebrowser.browser import pdfjs
|
||||||
|
|
||||||
|
|
||||||
@ -152,6 +152,22 @@ def _module_versions():
|
|||||||
return lines
|
return lines
|
||||||
|
|
||||||
|
|
||||||
|
def _path_info():
|
||||||
|
"""Get info about important path names.
|
||||||
|
|
||||||
|
Return:
|
||||||
|
A dictionary of descriptive to actual path names.
|
||||||
|
"""
|
||||||
|
return {
|
||||||
|
'config': standarddir.config(),
|
||||||
|
'data': standarddir.data(),
|
||||||
|
'system_data': standarddir.system_data(),
|
||||||
|
'cache': standarddir.cache(),
|
||||||
|
'download': standarddir.download(),
|
||||||
|
'runtime': standarddir.runtime(),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def _os_info():
|
def _os_info():
|
||||||
"""Get operating system info.
|
"""Get operating system info.
|
||||||
|
|
||||||
@ -255,4 +271,12 @@ def version():
|
|||||||
"Imported from {}".format(importpath),
|
"Imported from {}".format(importpath),
|
||||||
]
|
]
|
||||||
lines += _os_info()
|
lines += _os_info()
|
||||||
|
|
||||||
|
lines += [
|
||||||
|
'',
|
||||||
|
'Paths:',
|
||||||
|
]
|
||||||
|
for name, path in _path_info().items():
|
||||||
|
lines += ['{}: {}'.format(name, path)]
|
||||||
|
|
||||||
return '\n'.join(lines)
|
return '\n'.join(lines)
|
||||||
|
@ -21,9 +21,14 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from PyQt5.QtCore import QProcess
|
||||||
|
|
||||||
|
from end2end.fixtures import quteprocess, testprocess
|
||||||
|
|
||||||
|
|
||||||
def _base_args(config):
|
def _base_args(config):
|
||||||
"""Get the arguments to pass with every invocation."""
|
"""Get the arguments to pass with every invocation."""
|
||||||
@ -177,3 +182,24 @@ def test_optimize(request, quteproc_new, capfd, level):
|
|||||||
# Waiting for quit to make sure no other warning is emitted
|
# Waiting for quit to make sure no other warning is emitted
|
||||||
quteproc_new.send_cmd(':quit')
|
quteproc_new.send_cmd(':quit')
|
||||||
quteproc_new.wait_for_quit()
|
quteproc_new.wait_for_quit()
|
||||||
|
|
||||||
|
|
||||||
|
def test_version(request):
|
||||||
|
"""Test invocation with --version argument."""
|
||||||
|
args = ['--version'] + _base_args(request.config)
|
||||||
|
# can't use quteproc_new here because it's confused by
|
||||||
|
# early process termination
|
||||||
|
proc = quteprocess.QuteProc(request)
|
||||||
|
proc.proc.setProcessChannelMode(QProcess.SeparateChannels)
|
||||||
|
|
||||||
|
try:
|
||||||
|
proc.start(args)
|
||||||
|
proc.wait_for_quit()
|
||||||
|
except testprocess.ProcessExited:
|
||||||
|
assert proc.proc.exitStatus() == QProcess.NormalExit
|
||||||
|
else:
|
||||||
|
pytest.fail("Process did not exit!")
|
||||||
|
|
||||||
|
output = bytes(proc.proc.readAllStandardOutput()).decode('utf-8')
|
||||||
|
|
||||||
|
assert re.search(r'^qutebrowser\s+v\d+(\.\d+)', output) is not None
|
||||||
|
@ -313,6 +313,30 @@ def test_release_info(files, expected, caplog, monkeypatch):
|
|||||||
assert caplog.records[0].message == "Error while reading fake-file."
|
assert caplog.records[0].message == "Error while reading fake-file."
|
||||||
|
|
||||||
|
|
||||||
|
def test_path_info(monkeypatch):
|
||||||
|
"""Test _path_info()."""
|
||||||
|
patches = {
|
||||||
|
'config': lambda: 'CONFIG PATH',
|
||||||
|
'data': lambda: 'DATA PATH',
|
||||||
|
'system_data': lambda: 'SYSTEM DATA PATH',
|
||||||
|
'cache': lambda: 'CACHE PATH',
|
||||||
|
'download': lambda: 'DOWNLOAD PATH',
|
||||||
|
'runtime': lambda: 'RUNTIME PATH',
|
||||||
|
}
|
||||||
|
|
||||||
|
for attr, val in patches.items():
|
||||||
|
monkeypatch.setattr('qutebrowser.utils.standarddir.' + attr, val)
|
||||||
|
|
||||||
|
pathinfo = version._path_info()
|
||||||
|
|
||||||
|
assert pathinfo['config'] == 'CONFIG PATH'
|
||||||
|
assert pathinfo['data'] == 'DATA PATH'
|
||||||
|
assert pathinfo['system_data'] == 'SYSTEM DATA PATH'
|
||||||
|
assert pathinfo['cache'] == 'CACHE PATH'
|
||||||
|
assert pathinfo['download'] == 'DOWNLOAD PATH'
|
||||||
|
assert pathinfo['runtime'] == 'RUNTIME PATH'
|
||||||
|
|
||||||
|
|
||||||
class ImportFake:
|
class ImportFake:
|
||||||
|
|
||||||
"""A fake for __import__ which is used by the import_fake fixture.
|
"""A fake for __import__ which is used by the import_fake fixture.
|
||||||
@ -644,6 +668,7 @@ def test_version_output(git_commit, frozen, style, equal_qt, with_webkit,
|
|||||||
'platform.platform': lambda: 'PLATFORM',
|
'platform.platform': lambda: 'PLATFORM',
|
||||||
'platform.architecture': lambda: ('ARCHITECTURE', ''),
|
'platform.architecture': lambda: ('ARCHITECTURE', ''),
|
||||||
'_os_info': lambda: ['OS INFO 1', 'OS INFO 2'],
|
'_os_info': lambda: ['OS INFO 1', 'OS INFO 2'],
|
||||||
|
'_path_info': lambda: {'PATH DESC': 'PATH NAME'},
|
||||||
'QApplication': (stubs.FakeQApplication(style='STYLE') if style else
|
'QApplication': (stubs.FakeQApplication(style='STYLE') if style else
|
||||||
stubs.FakeQApplication(instance=None)),
|
stubs.FakeQApplication(instance=None)),
|
||||||
}
|
}
|
||||||
@ -674,6 +699,9 @@ def test_version_output(git_commit, frozen, style, equal_qt, with_webkit,
|
|||||||
Imported from {import_path}
|
Imported from {import_path}
|
||||||
OS INFO 1
|
OS INFO 1
|
||||||
OS INFO 2
|
OS INFO 2
|
||||||
|
|
||||||
|
Paths:
|
||||||
|
PATH DESC: PATH NAME
|
||||||
""".lstrip('\n'))
|
""".lstrip('\n'))
|
||||||
|
|
||||||
substitutions = {
|
substitutions = {
|
||||||
|
Loading…
Reference in New Issue
Block a user