summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAnder Punnar <ander@kvlt.ee>2021-04-24 11:05:45 +0300
committerAnder Punnar <ander@kvlt.ee>2021-04-24 11:05:45 +0300
commit55103390b723ff33e7e7307198373e2b915628db (patch)
tree077a29b43491fe50c07916068a6d29d3738c36d9 /tests
parent0fe9520042f6ad46fbc55a3b92793c85c13e5b7c (diff)
parent2599e9bc9796d255ffd4f350bd9aace7fb3893e3 (diff)
downloadqutebrowser-55103390b723ff33e7e7307198373e2b915628db.tar.gz
qutebrowser-55103390b723ff33e7e7307198373e2b915628db.zip
Merge remote-tracking branch 'origin/master' into 4nd3r/hostblock_subdomains
Diffstat (limited to 'tests')
-rw-r--r--tests/end2end/features/spawn.feature7
-rw-r--r--tests/unit/test_app.py3
-rw-r--r--tests/unit/utils/test_version.py21
3 files changed, 29 insertions, 2 deletions
diff --git a/tests/end2end/features/spawn.feature b/tests/end2end/features/spawn.feature
index 1c360893c..ba2cc7474 100644
--- a/tests/end2end/features/spawn.feature
+++ b/tests/end2end/features/spawn.feature
@@ -44,8 +44,14 @@ Feature: :spawn
When I run :spawn -u -m (echo-exe) Message 2
Then the message "Message 2" should be shown
+ Scenario: Running :spawn with -u -o
+ When I run :spawn -u -o (echo-exe) Message 3
+ And I wait for "load status for * url='qute://process/*'>: LoadStatus.success" in the log
+ Then the page should contain the plaintext "Message 3"
+
@posix
Scenario: Running :spawn with userscript
+ Given I clean up open tabs
When I open data/hello.txt
And I run :spawn -u (testdata)/userscripts/open_current_url
And I wait until data/hello.txt is loaded
@@ -66,6 +72,7 @@ Feature: :spawn
@windows
Scenario: Running :spawn with userscript on Windows
+ Given I clean up open tabs
When I open data/hello.txt
And I run :spawn -u (testdata)/userscripts/open_current_url.bat
And I wait until data/hello.txt is loaded
diff --git a/tests/unit/test_app.py b/tests/unit/test_app.py
index 9c83449c4..e359f2136 100644
--- a/tests/unit/test_app.py
+++ b/tests/unit/test_app.py
@@ -21,6 +21,7 @@
from PyQt5.QtCore import QBuffer
+from qutebrowser.misc import objects
from qutebrowser import app
@@ -30,7 +31,7 @@ def test_on_focus_changed_issue1484(monkeypatch, qapp, caplog):
For some reason, Qt sometimes calls on_focus_changed() with a QBuffer as
argument. Let's make sure we handle that gracefully.
"""
- monkeypatch.setattr(app, 'q_app', qapp)
+ monkeypatch.setattr(objects, 'qapp', qapp)
buf = QBuffer()
app.on_focus_changed(buf, buf)
diff --git a/tests/unit/utils/test_version.py b/tests/unit/utils/test_version.py
index 59f9052ca..734b70468 100644
--- a/tests/unit/utils/test_version.py
+++ b/tests/unit/utils/test_version.py
@@ -484,8 +484,17 @@ class TestGitStrSubprocess:
@needs_git
def test_real_git(self, git_repo):
"""Test with a real git repository."""
+ branch_name = subprocess.run(
+ ['git', 'config', 'init.defaultBranch'],
+ check=False,
+ stdout=subprocess.PIPE,
+ encoding='utf-8',
+ ).stdout.strip()
+ if not branch_name:
+ branch_name = 'master'
+
ret = version._git_str_subprocess(str(git_repo))
- assert ret == '6e4b65a on master (1970-01-01 01:00:00 +0100)'
+ assert ret == f'6e4b65a on {branch_name} (1970-01-01 01:00:00 +0100)'
def test_missing_dir(self, tmp_path):
"""Test with a directory which doesn't exist."""
@@ -1165,6 +1174,16 @@ class TestChromiumVersion:
assert versions.source == 'importlib'
assert versions.webengine == expected
+ @pytest.mark.parametrize('override', [
+ utils.VersionNumber(5, 12, 10),
+ utils.VersionNumber(5, 15, 3),
+ ])
+ def test_override(self, monkeypatch, override):
+ monkeypatch.setenv('QUTE_QTWEBENGINE_VERSION_OVERRIDE', str(override))
+ versions = version.qtwebengine_versions(avoid_init=True)
+ assert versions.source == 'override'
+ assert versions.webengine == override
+
@dataclasses.dataclass
class VersionParams: