summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2023-12-01 23:14:49 +0100
committerFlorian Bruhin <me@the-compiler.org>2023-12-01 23:31:34 +0100
commiteabbdb8ea31167e53407c21830ed7f13ea7ce805 (patch)
treed4c42a2425df9bd946fe6571d191fcaf04b5a970 /tests
parent0c3c1310748d85f26f8b0ba9ed8b0c0c464c02bd (diff)
downloadqutebrowser-eabbdb8ea31167e53407c21830ed7f13ea7ce805.tar.gz
qutebrowser-eabbdb8ea31167e53407c21830ed7f13ea7ce805.zip
pdfjs: Fix :version crash with no pdf.js
pdfjs.get_pdf_basename() returned None, causing in a TypeError. Instead of throwing mocker.patch at it, fix the underlying issue. Given we made the same mistake in three places: - :version - test_real_file for PDF.js - is_available() in pdfjs.py (calls the function but doesn't use the result, so is a nop now, even if PDF.js wasn't found) ...evidently we need to change the API so it still raises an exception if no PDF.js is available. Amends 0144ae3576aaecde295d40e22d636f04240d6761.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/utils/test_version.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/tests/unit/utils/test_version.py b/tests/unit/utils/test_version.py
index dcb625b1e..1a337d7c5 100644
--- a/tests/unit/utils/test_version.py
+++ b/tests/unit/utils/test_version.py
@@ -849,13 +849,11 @@ class TestPDFJSVersion:
"""Tests for _pdfjs_version."""
def test_not_found(self, mocker):
- mocker.patch('qutebrowser.utils.version.pdfjs.get_pdfjs_basename')
mocker.patch('qutebrowser.utils.version.pdfjs.get_pdfjs_res_and_path',
side_effect=pdfjs.PDFJSNotFound('/build/pdf.js'))
assert version._pdfjs_version() == 'no'
- def test_unknown(self, monkeypatch, mocker):
- mocker.patch('qutebrowser.utils.version.pdfjs.get_pdfjs_basename')
+ def test_unknown(self, monkeypatch):
monkeypatch.setattr(
'qutebrowser.utils.version.pdfjs.get_pdfjs_res_and_path',
lambda path: (b'foobar', None))
@@ -880,7 +878,6 @@ class TestPDFJSVersion:
// Use strict in our context only - users might not want it
'use strict';
""".replace('VARNAME', varname)).strip().encode('utf-8')
- mocker.patch('qutebrowser.utils.version.pdfjs.get_pdfjs_basename')
monkeypatch.setattr(
'qutebrowser.utils.version.pdfjs.get_pdfjs_res_and_path',
lambda path: (pdfjs_code, '/foo/bar/pdf.js'))