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
48ea86fcb5
Rename some qt6 FIXMEs
...
Not relevant for v3 and qt6
2023-06-25 23:32:59 +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
28f437c214
Revert "tests: Add a test for implicit Qt init"
...
This reverts commit 220337f870 .
Has various side-effects during tests due to global state.
2023-06-24 20:44:53 +02:00
Florian Bruhin
220337f870
tests: Add a test for implicit Qt init
2023-06-23 23:28:57 +02:00
Florian Bruhin
89b81c4b3a
tests: Widen xfail range for ELF to Qt 6.6+
2023-06-15 16:24:21 +02:00
Florian Bruhin
d6af539454
qt: Use warning instead if Qt was already imported
2023-06-14 19:09:58 +02:00
Florian Bruhin
69c21a5751
qt: Use outcomes dict instead of attributes for SelectionInfo
2023-06-14 19:03:34 +02:00
Florian Bruhin
54aef75a29
qt: Sort wrappers in SelectionInfo correctly
2023-06-14 19:03:34 +02:00
Florian Bruhin
5be71197d1
qt: Allow opt-in to autoselection and enable tests
2023-06-14 19:03:34 +02:00
Florian Bruhin
b9253c90fe
qt: Improve SelectionInfo.__str__()
2023-06-13 20:13:06 +02:00
Florian Bruhin
ca4cd3a24f
qt: Refactor SelectionInfo.set_module_error
2023-06-13 19:56:21 +02:00
Florian Bruhin
92243041c2
qt: Stop trying other wrappers on ImportError
2023-06-13 19:51:22 +02:00
Florian Bruhin
1313704802
qt: Add wrapper info to backendproblem messages
2023-06-13 19:32:50 +02:00
Florian Bruhin
0175c00d0f
qt: Make sure to undo all global state changes
2023-06-13 18:53:00 +02:00
Florian Bruhin
13c412f13e
qt: Fix lint
2023-06-13 18:53:00 +02:00
Florian Bruhin
d9543de98c
qt: Fix test_version
2023-06-13 17:02:54 +02:00
Florian Bruhin
63e96fa3fe
qt: Split machinery.init() and init_explicit() into two functions
...
This also moves the checking for sys.modules into _select_wrapper.
2023-06-13 17:01:15 +02:00
Florian Bruhin
322834d0e6
qt: Integrate machinery into earlyinit properly
...
This means we will now get errors via the usual mechanisms
(e.g. a Tk error dialog) when all Qt wrappers failed to import.
We also add information about the picked Qt wrapper (and any errors)
to the error message.
2023-06-13 16:36:03 +02:00
Florian Bruhin
7691556ea1
qt: Fix tests for SelectionInfo changes
2023-06-13 15:21:41 +02:00
Florian Bruhin
1cf9d68aba
qt: Fix lint
2023-06-13 15:21:28 +02:00
Florian Bruhin
9588e0aec0
qt: Treat empty QUTE_QT_WRAPPER as unset
2023-06-13 12:18:44 +02:00
Florian Bruhin
a25e8a0987
qt: Less stringly-typed API for SelectionInfo
2023-06-13 12:18:39 +02:00
Florian Bruhin
83bef2ad4b
qt: Add machinery.SelectionInfo
2023-06-13 12:09:48 +02:00
Florian Bruhin
8fdb5b09be
qt: Fix typing/lint
2023-06-12 23:59:11 +02:00
Florian Bruhin
eeb39d6330
qt: Add tests for machinery
2023-06-12 23:34:27 +02:00
Florian Bruhin
c62e9aba5b
Work around Python 3.12 test issues
...
See #7727
2023-06-09 20:06:40 +02:00
Florian Bruhin
e1d0b3c543
tests: Adjust urlmatch exception message patterns for Python 3.11.4
2023-06-08 17:17:40 +02:00
Florian Bruhin
8b058389b7
test: Adjust test_nul_bytes version check
...
Python 3.11.4 also got the fix backported which turns this into a SyntaxError:
https://github.com/python/cpython/pull/104195
2023-06-08 16:59:19 +02:00
Florian Bruhin
368061dc3d
Merge branch 'update-dependencies'
2023-05-31 15:49:46 +02:00
Florian Bruhin
818a133d91
tests: Make sure QNetworkDiskCacheMetadata has a header set
...
Qt 6.5.1 started treating the absence of a header as the cache entry
being corrupted...
https://bugreports.qt.io/browse/QTBUG-111397
https://codereview.qt-project.org/c/qt/qtbase/+/465547
2023-05-31 14:08:50 +02:00
Florian Bruhin
e65325ae4d
Also skip ELF test on Qt 6.5.1
...
See #7624
2023-05-31 13:07:34 +02:00
Florian Bruhin
e70f5b0318
Merge branch 'process-message-improvements'
2023-05-31 12:23:33 +02:00
Florian Bruhin
feae08cbc2
Skip process message test on Windows
2023-05-31 12:23:09 +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
5cef49ff30
Improve process output in case of signals
...
See https://www.reddit.com/r/qutebrowser/comments/13tqp55/command_crashed_see_process_for_details/
2023-05-28 18:29:19 +02:00
Florian Bruhin
c41f152fa5
Show PID in :process error message
...
See https://www.reddit.com/r/qutebrowser/comments/13tqp55/command_crashed_see_process_for_details/
2023-05-28 13:02:48 +02:00
Florian Bruhin
e7295740ee
tests: Fix broken mock assertions
...
Uncovered in Python 3.12
2023-04-11 15:29:41 +02:00
Florian Bruhin
5d890f14d0
tests: Handle Python 3.12 with NUL bytes config.py
2023-04-11 15:29:25 +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