Commit Graph

2001 Commits

Author SHA1 Message Date
Florian Bruhin ec34865168 Move master branch references to main
Closes #7097
2023-07-23 11:38:19 +02:00
Philipp Albrecht e3a58e84c6 Don't crash on --logfilter 2023-07-20 15:09:48 +02:00
Philipp Albrecht 45f6cf01c3 Don't show warning when jumping to next/prev without matches 2023-07-05 11:16:55 +02:00
Philipp Albrecht d9e8b638bf Remove vim modelines
We're deprecating vim modelines in favor of `.editorconfig`.

Removing vim modelines could be done using two one-liners. Most of the vim modelines
were followed by an empty line, so this one-liner took care of these ones:

```sh
rg '^# vim: .+\n\n' -l | xargs sed -i '/^# vim: /,+1d'
```

Then some of the vim modelines were followed by a pylint configuration line, so running
this one-liner afterwards took care of that:

```sh
rg '^# vim:' -l | xargs sed -i '/^# vim: /d'
```
2023-06-30 11:03:06 +02:00
Florian Bruhin 5fa878c7d1 py38: Run modified pyupgrade
Modified to leave f-strings alone for now, and also not do some other
stuff we should do separately:

    diff --git i/pyupgrade/_main.py w/pyupgrade/_main.py
    index 4292174..37547b3 100644
    --- i/pyupgrade/_main.py
    +++ w/pyupgrade/_main.py
    @@ -294,7 +294,8 @@ def _fix_tokens(contents_text: str) -> str:
                    token.utf8_byte_offset == 0 and
                    token.line < 3 and
                    token.name == 'COMMENT' and
    -                tokenize.cookie_re.match(token.src)
    +                tokenize.cookie_re.match(token.src) and
    +                False
            ):
                del tokens[i]
                assert tokens[i].name == 'NL', tokens[i].name
    diff --git i/pyupgrade/_plugins/fstrings.py w/pyupgrade/_plugins/fstrings.py
    index e648075..eb44c0c 100644
    --- i/pyupgrade/_plugins/fstrings.py
    +++ w/pyupgrade/_plugins/fstrings.py
    @@ -88,7 +88,7 @@ def _format_params(call: ast.Call) -> set[str]:
        return params

    -@register(ast.Call)
    +# @register(ast.Call)
    def visit_Call(
            state: State,
            node: ast.Call,
    diff --git i/pyupgrade/_plugins/open_mode.py w/pyupgrade/_plugins/open_mode.py
    index a20b95c..0388781 100644
    --- i/pyupgrade/_plugins/open_mode.py
    +++ w/pyupgrade/_plugins/open_mode.py
    @@ -28,7 +28,7 @@ def _permute(*args: str) -> tuple[str, ...]:
        return tuple(''.join(p) for s in args for p in itertools.permutations(s))

    -MODE_REMOVE = frozenset(_permute('U', 'r', 'rU', 'rt'))
    +MODE_REMOVE = frozenset(_permute('U', 'rU', 'rt'))
    MODE_REPLACE_R = frozenset(_permute('Ub'))
    MODE_REMOVE_T = frozenset(_plus(_permute('at', 'rt', 'wt', 'xt')))
    MODE_REMOVE_U = frozenset(_permute('rUb'))

Then run with:

    git ls-files | grep -E '(\.py|misc/userscripts)' | xargs ~/tmp/pyupgrade/.venv/bin/pyupgrade --py38-plus

And manually reverted some changes (e.g. it picking up bash userscripts)
2023-06-26 14:39:54 +02:00
Florian Bruhin 93c7fdd60c Initial Python 3.7 drop 2023-06-26 14:39:54 +02:00
Florian Bruhin 9e9b57772e tests: Resurrect :print --pdf test 2023-06-26 13:50:19 +02:00
Florian Bruhin e15223211c Fix :print --pdf with subdirectories
Fixes #5160
2023-06-26 13:50:19 +02:00
Florian Bruhin 036af85199 Revert "Work around Python 3.12 test issues"
Fixed with newest PyQt snapshot.
This reverts commit c62e9aba5b.
2023-06-25 21:48:12 +02:00
Florian Bruhin c62e9aba5b Work around Python 3.12 test issues
See #7727
2023-06-09 20:06:40 +02:00
Florian Bruhin e70f5b0318 Merge branch 'process-message-improvements' 2023-05-31 12:23:33 +02:00
Florian Bruhin 68e61a239d ci: Ignore spurious QPainter messages 2023-05-31 12:08:10 +02:00
Florian Bruhin 58436a2955 Fix lint/tests 2023-05-29 13:56:04 +02:00
Florian Bruhin 3e4d021070 tests: Fix relative URL for caret test
Similar issue as with ab7245732e
2023-04-07 15:45:20 +02:00
Florian Bruhin 54026a3217 tests: Ignore another Qt 6.5 debug message
See https://github.com/qutebrowser/qutebrowser/issues/7624
2023-04-06 22:55:53 +02:00
Florian Bruhin fd4217ffd2 tests: Make download error more forgiving
For unknown reasons, on nightly CI we now get TWO errors:

<qutebrowser.browser.webkit.certificateerror.CertificateErrorWrapper errors=['NoPeerCertificate', 'SelfSignedCertificate'] string='The peer did not present any certificate\nThe certificate is self-signed, and untrusted'>
2023-03-29 15:15:11 +02:00
toofar c5803587c1 tests: Add text content to another HTML file
I saw this test fail on windows at some point with what looked like the
same issue. (Couldn't find an element to click.)

ref; #7621
2023-03-25 18:38:27 +13:00
toofar cb0b51c094 tests: wait for flaky iframes to load via JS
TL;DR: I think I stabilized a couple of hinting iframe tests and applied
that change to all the iframe usages in the end2end tests in the hopes
that it would resolve some other flaky tests.

I was facing some tests that hinted elements in iframes failing
intermittently recently. They were most consistently failing on the
windows runner. This is similar to the trend described in the comment
linked from #1525.

The tests failing recently where:

    tests (py39-pyqt515, windows-2019, 3.9)
    test_using_hintfollow_inside_an_iframe
    test_using_hintfollow_inside_an_iframe_button

    tests (py311-pyqt515, ubuntu-20.04, 3.11)
    test_using_hintfollow_inside_an_iframe
    test_using_hintfollow_inside_an_iframe_button

They are failing because hints don't get generated for the elements in
the iframe. I can see hints do get generated for the iframe itself
though.
Examining the logs in 5.15 it seems that there is a
`cur_load_finished(True) (tab *)` log line after we run :hint. I suspect
that this is the load finished signal for the iframe.
I attempted to change the bdd open_path function to wait for the current
message it's looking for and then additionally look for that
cur_load_finished signal, but then it starts failing locally when the
iframe load signal actually comes before the parent frame one. Just
looking for the cur_load_finished signal itself also always found it
immediately ("already found"), probably from the parent frame.

So instead of trying to deal with that indeterminate ordering or
trying to change the signals to say what frame they are coming from, I
added javascript to all the pages used in iframes that run on load, and
changed all the tests to watch for log messages from the JS.

It's not the most maintainable solution, perhaps if we generated our
test files with jinja we could have some "subframe loaded" boilerplate,
get a message to log from a query param, look at metadata from test
files for the open_path checking etc.

I then searched for all the iframe usages in the test data and applied
that change to all of those files and all the tests that used them. A
few of those tests also had `flaky` annotations on them. I removed those
annotations for now in the hopes that there were affected by the same
problem. And that I actually managed to work around it correctly.

ref: #7621
2023-03-25 18:37:58 +13:00
Florian Bruhin fe6687f2ea tests: Stabilize "Hinting an input after undoing a tab close"
Without this wait, the test is flaky, because sometimes the keys are pressed
before qutebrowser has entered insert mode.

When running:

    tox -e py311-pyqt64 -- tests/end2end/features/test_hints_bdd.py -k undoing --count 100

around 30% of the runs, we get:

============================== :click-element id qute-input-existing ==============================

[...]

----> Waiting for 'command called: *' in the log
[...]
17:56:54.042 DEBUG    commands   command:run:549 Calling qutebrowser.components.misccommands.click_element(<qutebrowser.browser.webengine.webenginetab.WebEngineTab tab_id=197 url='http://localhost:50977/data/hints/link_input.html'>, 'id', 'qute-input-existing', target=<ClickTarget.normal: 1>, force_event=False, select_first=False)
17:56:54.043 DEBUG    ipc        ipc:_get_socket:373 In _get_socket with None socket!
----> found it

============================== :fake-key -g something ==============================

[...]

----> Waiting for '[*] contents: existingsomething' in the log
17:56:54.062 DEBUG    modes      modeman:_handle_keypress:290 got keypress in mode KeyMode.normal - delegating to <qutebrowser.keyinput.modeparsers.NormalKeyParser>
[...]
17:56:54.111 DEBUG    modes      modeman:_handle_keypress:290 got keypress in mode KeyMode.normal - delegating to <qutebrowser.keyinput.modeparsers.NormalKeyParser>
[...]
17:56:54.112 DEBUG    modes      modeman:_handle_keypress:290 got keypress in mode KeyMode.normal - delegating to <qutebrowser.keyinput.modeparsers.NormalKeyParser>
[...]
17:56:54.113 DEBUG    commands   command:run:535 command called: quickmark-save
[...]
17:56:54.143 DEBUG    webview    webenginetab:_js_cb_single:766 Got element from JS: {'attributes': {'id': 'qute-input-existing', 'value': 'existing'}, 'caret_position': 0, 'class_name': '', 'id': 0, 'is_content_editable': False, 'outer_xml': '<input id="qute-input-existing" value="existing">', 'rects': [{'bottom': 143, 'height': 21, 'left': 8, 'right': 166, 'top': 122, 'width': 158}], 'tag_name': 'INPUT', 'text': '', 'value': 'existing'}
17:56:54.143 DEBUG    webelem    webelem:click:422 Clicking <qutebrowser.browser.webengine.webengineelem.WebEngineElement html='<input id="qute-input-existing" value="existing">'> with click_target ClickTarget.normal, force_event False
17:56:54.143 DEBUG    webelem    webelem:is_editable:257 Checking if element is editable: <qutebrowser.browser.webengine.webengineelem.WebEngineElement html='<input id="qute-input-existing" value="existing">'>
17:56:54.143 DEBUG    webelem    webelem:click:434 Clicking via JS focus()
17:56:54.144 DEBUG    webelem    webelem:is_editable:257 Checking if element is editable: <qutebrowser.browser.webengine.webengineelem.WebEngineElement html='<input id="qute-input-existing" value="existing">'>
17:56:54.144 DEBUG    modes      modeman:enter:366 Entering mode KeyMode.insert (reason: clicking input)

With the change, the test passes 100/100 times.
2023-03-23 18:10:22 +01:00
Florian Bruhin 0510ffcfa9 tests: Remove before_first_request for webserver_sub_ssl
This was first introduced in adbdfcbad3,
most likely because we got logging from the built-in Werkzeug webserver.

It doesn't seem to be needed anymore, possibly since
41c4ee3e2f where we started using CherryPy
for the SSL server too.

This should fix nighly bleeding tests, because the before_first_request
decorator got removed in Flask:

https://github.com/pallets/flask/pull/4621
https://github.com/pallets/flask/pull/4995
2023-03-20 17:23:55 +01:00
toofar 294e73660c Re-focus tabs created from :undo
There's some weird issue with Qt6.4 and 6.5 where a webengine view gets
its widget swapped out when it gets history deserialized into it. While
it's swapping widgets it has no so the focus gets passed to some other
widget should never even have focus.

There's probably more comprehensive ways we could handle this, by
overriding the WebEngineView layout, or by overriding focusNextPrevChild
on the parent to put out own logic into the "child is going, pass focus
to parent" logic chain.

But all that seems like a bit too much of a headache for this very
focussed issue. We want the new tab to get focus, so lets re-focus it.
Technically we could just focus the last tab that we open, if we are
undoing multiple, but the existing logic is to open each of them in turn
as foreground tabs and this reinforces that.

Closes: #7623
2023-03-19 13:23:18 +13:00
toofar cb9f3fa141 tests: skip special URL deserializing tests on win
Not sure why its failing on windows, but it only really needs to run in
one environment anyway.
Previously this was using chrome://gpu but that was failing on CI due to
it invoking some vulkan stuff the didn't work without a GPU. I changed
it to chrome://sandbox/ for no good reason, but it seems to be working
fine on ubuntu at least.

Follow up to 151d808940
2023-03-18 19:13:26 +13:00
toofar c55f899c83 tests: add some text to another test HTML file
This one is for 6.5. Interesting that it was fine on 6.4.

I haven't gone and added text to all the test file because I'm hoping
it'll be something that upstream addresses in short order. So I'm only
adding text to files used by failing tests.

See d413b87c3f #7621 and #7624
2023-03-18 17:32:48 +13:00
toofar fa70b4a319 tests: ignore new blink "message rejected" log 2023-03-18 17:29:25 +13:00
toofar 151d808940 change "special url" in tests to avoid vulkan error
On GH actions I'm seeing an "unexpected line" failure around creating a
vulkan context when loading chrome://gpu

    ERROR tests/end2end/features/test_tabs_bdd.py::test_cloning_a_tab_with_a_special_url - end2end.fixtures.testprocess.InvalidLine:
    1829
    Error: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
    1830
        at CheckVkSuccessImpl (../../../3rdparty/chromium/third_party/dawn/src/dawn/native/vulkan/VulkanError.cpp:88)
    1831
        at CreateVkInstance (../../../3rdparty/chromium/third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:360)
    1832
        at Initialize (../../../3rdparty/chromium/third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:235)
    1833
        at Create (../../../3rdparty/chromium/third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:165)
    1834
        at operator() (../../../3rdparty/chromium/third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:420)

I'm not sure its actually failing the test, we are just seeing the error
in the logs and flagging it.
Instead of adding the logs to an ignore list I'm going to switch the
page we use so that if the error comes up for real we'll be sure to see
the logs.
2023-03-18 16:47:12 +13:00
toofar d413b87c3f Add some text to test HTML pages.
With 6.4 and 6.5 it looks like pages without text on them only render
after a delay (on the order of hundreds of milliseconds).

ref: #7621
2023-03-18 16:47:12 +13:00
toofar 856fe781a1 Merge remote-tracking branch 'upstream/qt6-v2' into master-qt6 2023-03-18 16:24:58 +13:00
Florian Bruhin 4793070db3 Merge branch 'qt6-v2' into master-qt6 2023-03-17 20:30:13 +01:00
Florian Bruhin 9b7348a880 Qt 6.5: Always use new dark mode values for newer Qt's
I don't quite understand why the value changed from #00000 to #121212
there with Qt 6.3, but it looks like the change is here to stay.

Instead of keeping #000000 the default and adding an override for every
new Qt release, let's just switch over and add an override for the old
versions (5.15 and 6.2), so this won't break again for every new release.

See #7624
2023-03-17 17:27:37 +01:00
Florian Bruhin 2d45f6f002 tests: Ignore more Qt 6.5 / debug build messages
See #7624
2023-03-17 17:27:29 +01:00
Florian Bruhin 6e48c9f1a9 Revert "lint: add stacklevel kwarg to warnings"
This reverts commit 47be6f3aeb.

This doesn't really make sense in test files, as the warning would point
inside some internal pytest code, which is not helpful.

Instead, let's just disable the corresponding flake8 warning in tests.
2023-03-14 11:57:24 +01:00
toofar 47be6f3aeb lint: add stacklevel kwarg to warnings
flake8-bugbear B028 No explicit stacklevel keyword argument found. The
warn method from the warnings module uses a stacklevel of 1 by default.
This will only show a stack trace for the line on which the warn method
is called. It is therefore recommended to use a stacklevel of 2 or
greater to provide more information to the user.

Semgrep helped:

    semgrep --lang=py -e 'warnings.warn($ARG)' --replacement 'warnings.warn($ARG, stacklevel=2)' $FILES -a
    semgrep --lang=py -e 'warnings.warn($ARG1, $ARG2)' --replacement 'warnings.warn($ARG1, $ARG2, stacklevel=2)' $FILES -a

Although it did lose the f-string on one of them.
2023-02-26 13:39:35 +13:00
toofar ce134c9662 lint: superfluous-parens and useless-suppression
Unnecessary parens after '=' keyword
2023-02-06 19:50:22 +13:00
toofar ff8dbc4580 lint: broad-exception-raised
Mostly pretty lazy fixes. Most of the places in the tests we were
already matching on error message, a couple of places we weren't. The
tick-tock one was the only one that wasn't being used right where it was
raised.

Some of them I just changed to RuntimeError because it was shorter than
adding the pylint directive.
2023-02-06 18:53:56 +13:00
Florian Bruhin 0941c59c3b tests: Ignore another spurious Chromium error 2022-12-13 09:43:08 +01:00
Florian Bruhin b4d32e04f4 Merge branch 'master' into qt6-v2 2022-12-13 09:05:32 +01:00
Florian Bruhin 725ed95d8a tests: Fix downloads.feature flakiness
The "Answering a question for a cancelled download" test was flaky,
due to the preceding PDF.js test sometimes not waiting properly for its
download to finish: "I wait until the download is finished" waited for
the initial PDF download above (which causes PDF.js to open), but not
for the real download after clicking the save button.

See #5390

TODO: Cherry-pick to master?
2022-11-24 14:56:52 +01:00
Florian Bruhin e11f899b41 tests: Ignore new QtWebEngine 6.4 message
See #7314
2022-11-24 14:19:38 +01:00
Florian Bruhin f6e4ba3d6f Make skipping broken PDF.js work properly
Fixup for c7ea2f705f
See #7135
2022-11-24 14:12:38 +01:00
toofar 2d66466194 Merge branch 'master' into qt6-v2
Just a few conflicts around CI and dependencies.
2022-11-20 15:48:00 +13:00
Kian-Meng Ang d77b0fb8a3 Fix typos
Found via `codespell -S *.js -L
technik,gir,nam,ans,wih,wil,ro,nowe,te,datas,qutie,ned,fo,clude,alph,crashers,nd,wasn,cros,ue,possition`

Co-authored-by: Marcel Schilling <marcel.schilling@uni-luebeck.de>
2022-11-19 13:03:39 +08:00
Florian Bruhin 1387c999fa Skip problematic QtWebKit tests with OpenSSL 3
See https://github.com/cherrypy/cheroot/issues/517 and #7467
2022-11-08 16:17:31 +01:00
Florian Bruhin fa62360357 Remove unneeded str
Only needed in Python 3.5 times
2022-09-30 20:23:38 +02:00
Florian Bruhin 31878b4b7b Speculatively stabilize :history-clear tests
See #7415, #5390. Similar to ad429d9552a9f169a1122cb5784424848d4805e2.
2022-09-26 16:06:30 +02:00
Florian Bruhin 87f58a30b7 Fix half-finished test
(cherry picked from commit 40125ca73b)
2022-08-26 22:32:10 +02:00
Florian Bruhin 40125ca73b Fix half-finished test 2022-08-23 22:21:40 +02:00
Florian Bruhin 815374c6b6 js: Handle stylesheets in cross-origin frames gracefully
Otherwise the exception gets shown since the recent message change.

(cherry picked from commit 73e30e4738)
2022-08-23 20:10:57 +02:00
Florian Bruhin 73e30e4738 js: Handle stylesheets in cross-origin frames gracefully
Otherwise the exception gets shown since the recent message change.
2022-08-23 20:07:53 +02:00
Florian Bruhin 496c14bc9e quteprocess: Add --qute-delay-start
Allows for some rudimentary debugging of subprocesses.
2022-08-23 18:31:42 +02:00
Florian Bruhin d31b2e2016 Qt 6.4: Adjust dark mode tests
See #7314 and #6097
2022-08-23 18:31:42 +02:00