summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2017-03-08 09:25:46 +0100
committerFlorian Bruhin <git@the-compiler.org>2017-03-08 09:25:46 +0100
commit7ba01e67644d531b77315cdb4bda89f9a9811d39 (patch)
tree470afd15ca8fd9991c43ba8d3e9d445fe8634ab4
parentf86f9cd92a6c992a3a2f8dccd631ea3afb3a9413 (diff)
downloadqutebrowser-7ba01e67644d531b77315cdb4bda89f9a9811d39.tar.gz
qutebrowser-7ba01e67644d531b77315cdb4bda89f9a9811d39.zip
Get rid of utils.actute_warning
Only Ubuntu Trusty still uses Qt < 5.3, and the issue seems to be fixed there by now.
-rw-r--r--qutebrowser/app.py1
-rw-r--r--qutebrowser/utils/utils.py31
-rw-r--r--tests/unit/utils/test_utils.py121
3 files changed, 0 insertions, 153 deletions
diff --git a/qutebrowser/app.py b/qutebrowser/app.py
index aa9666d74..73215cbfe 100644
--- a/qutebrowser/app.py
+++ b/qutebrowser/app.py
@@ -133,7 +133,6 @@ def init(args, crash_handler):
log.init.debug("Starting init...")
qApp.setQuitOnLastWindowClosed(False)
_init_icon()
- utils.actute_warning()
try:
_init_modules(args, crash_handler)
diff --git a/qutebrowser/utils/utils.py b/qutebrowser/utils/utils.py
index e658cbf8f..fd4466e2a 100644
--- a/qutebrowser/utils/utils.py
+++ b/qutebrowser/utils/utils.py
@@ -158,37 +158,6 @@ def resource_filename(filename):
return pkg_resources.resource_filename(qutebrowser.__name__, filename)
-def actute_warning():
- """Display a warning about the dead_actute issue if needed."""
- # WORKAROUND (remove this when we bump the requirements to 5.3.0)
- # Non Linux OS' aren't affected
- if not sys.platform.startswith('linux'):
- return
- # If no compose file exists for some reason, we're not affected
- if not os.path.exists('/usr/share/X11/locale/en_US.UTF-8/Compose'):
- return
- # Qt >= 5.3 doesn't seem to be affected
- try:
- if qtutils.version_check('5.3'):
- return
- except ValueError: # pragma: no cover
- pass
- try:
- with open('/usr/share/X11/locale/en_US.UTF-8/Compose', 'r',
- encoding='utf-8') as f:
- for line in f:
- if '<dead_actute>' in line:
- if sys.stdout is not None:
- sys.stdout.flush()
- print("Note: If you got a 'dead_actute' warning above, "
- "that is not a bug in qutebrowser! See "
- "https://bugs.freedesktop.org/show_bug.cgi?id=69476 "
- "for details.")
- break
- except OSError:
- log.init.exception("Failed to read Compose file")
-
-
def _get_color_percentage(a_c1, a_c2, a_c3, b_c1, b_c2, b_c3, percent):
"""Get a color which is percent% interpolated between start and end.
diff --git a/tests/unit/utils/test_utils.py b/tests/unit/utils/test_utils.py
index c12a2f17c..3c00ca0c7 100644
--- a/tests/unit/utils/test_utils.py
+++ b/tests/unit/utils/test_utils.py
@@ -148,127 +148,6 @@ def test_resource_filename():
assert f.read().splitlines()[0] == "Hello World!"
-class Patcher:
-
- """Helper for TestActuteWarning.
-
- Attributes:
- monkeypatch: The pytest monkeypatch fixture.
- """
-
- def __init__(self, monkeypatch):
- self.monkeypatch = monkeypatch
-
- def patch_platform(self, platform='linux'):
- """Patch sys.platform."""
- self.monkeypatch.setattr(sys, 'platform', platform)
-
- def patch_exists(self, exists=True):
- """Patch os.path.exists."""
- self.monkeypatch.setattr(utils.os.path, 'exists', lambda path: exists)
-
- def patch_version(self, version='5.2.0'):
- """Patch Qt version."""
- self.monkeypatch.setattr(utils.qtutils, 'qVersion', lambda: version)
-
- def patch_file(self, data):
- """Patch open() to return the given data."""
- fake_file = io.StringIO(data)
- self.monkeypatch.setattr(utils, 'open',
- lambda filename, mode, encoding: fake_file,
- raising=False)
-
- def patch_all(self, data):
- """Patch everything so the issue would exist."""
- self.patch_platform()
- self.patch_exists()
- self.patch_version()
- self.patch_file(data)
-
-
-class TestActuteWarning:
-
- """Test actute_warning."""
-
- @pytest.fixture
- def patcher(self, monkeypatch):
- """Fixture providing a Patcher helper."""
- return Patcher(monkeypatch)
-
- def test_non_linux(self, patcher, capsys):
- """Test with a non-Linux OS."""
- patcher.patch_platform('toaster')
- utils.actute_warning()
- out, err = capsys.readouterr()
- assert not out
- assert not err
-
- def test_no_compose(self, patcher, capsys):
- """Test with no compose file."""
- patcher.patch_platform()
- patcher.patch_exists(False)
- utils.actute_warning()
- out, err = capsys.readouterr()
- assert not out
- assert not err
-
- def test_newer_qt(self, patcher, capsys):
- """Test with compose file but newer Qt version."""
- patcher.patch_platform()
- patcher.patch_exists()
- patcher.patch_version('5.4')
- utils.actute_warning()
- out, err = capsys.readouterr()
- assert not out
- assert not err
-
- def test_no_match(self, patcher, capsys):
- """Test with compose file and affected Qt but no match."""
- patcher.patch_all('foobar')
- utils.actute_warning()
- out, err = capsys.readouterr()
- assert not out
- assert not err
-
- def test_empty(self, patcher, capsys):
- """Test with empty compose file."""
- patcher.patch_all(None)
- utils.actute_warning()
- out, err = capsys.readouterr()
- assert not out
- assert not err
-
- def test_match(self, patcher, capsys):
- """Test with compose file and affected Qt and a match."""
- patcher.patch_all('foobar\n<dead_actute>\nbaz')
- utils.actute_warning()
- out, err = capsys.readouterr()
- assert out.startswith('Note: If you got a')
- assert not err
-
- def test_match_stdout_none(self, monkeypatch, patcher, capsys):
- """Test with a match and stdout being None."""
- patcher.patch_all('foobar\n<dead_actute>\nbaz')
- monkeypatch.setattr(sys, 'stdout', None)
- utils.actute_warning()
-
- def test_unreadable(self, mocker, patcher, capsys, caplog):
- """Test with an unreadable compose file."""
- patcher.patch_platform()
- patcher.patch_exists()
- patcher.patch_version()
- mocker.patch('qutebrowser.utils.utils.open', side_effect=OSError,
- create=True)
-
- with caplog.at_level(logging.ERROR, 'init'):
- utils.actute_warning()
-
- assert len(caplog.records) == 1
- assert caplog.records[0].message == 'Failed to read Compose file'
- out, _err = capsys.readouterr()
- assert not out
-
-
class TestInterpolateColor:
"""Tests for interpolate_color.