Commit Graph

24957 Commits

Author SHA1 Message Date
toofar 6dd73bf5e7 Begin upgrading to eslint9
Initial migration was just:

    import yaml
    with open('.eslintrc.yaml') as f:
      config=yaml.load(f.read(), yaml.CLoader)
    with open("eslint.config.js", "w") as f:
      json.dump(config, f)

Then add a new ignores key, figuring out how to import the default "all"
config, and the globals.

Added some ignore lines for undefined globals in the config file since
they are probably legitimately not available in a browser.

The `ignores` config item doesn't seem to be working, not sure why.

Other than that theres not many warnings from the files that are
actually supposed to be linted, so that's good!

I have no-idea how much of the rest of the config is or isn't working.
2024-04-06 18:25:00 +13:00
toofar 26dcc4a7a9 Add a :window-only for some qt5 end2end tests
A couple of tests seem to be failing because there is two windows open and
they don't expect it. I haven't fixed the root cause, I looked through the
logs and couldn't see why a second window was open. But if this makes the
tests pass, I guess we can address that if someone reports it.

Also changed `_get_scroll_values()` to handle multiple tabs/windows being open
too while I was there.

Example logs: https://github.com/qutebrowser/qutebrowser/actions/runs/8548730512/job/23422922448
Sessions file from the test logs:

  Current session data:
  windows:
  - geometry: !!binary |
      AdnQywADAAAAAAAyAAAAMgAAA1EAAAKJAAAAMgAAADIAAANRAAACiQAAAAAAAAAAAyAAAAAyAAAA
      MgAAA1EAAAKJ
    tabs:
    - active: true
      history:
      - active: true
        last_visited: '2024-04-04T03:21:00'
        pinned: false
        scroll-pos:
          x: 0
          y: 0
        title: about:blank
        url: about:blank
        zoom: 1.0
  - active: true
    geometry: !!binary |
      AdnQywADAAAAAAAyAAAAMgAAA1EAAAKJAAAAMgAAADIAAANRAAACiQAAAAAAAAAAAyAAAAAyAAAA
      MgAAA1EAAAKJ
    tabs:
    - active: true
      history:
      - active: true
        last_visited: '2024-04-04T03:21:03'
        pinned: false
        scroll-pos:
          x: 0
          y: 40
        title: Scrolling
        url: http://localhost:39235/data/scroll/simple.html
        zoom: 1.0
2024-04-06 12:05:31 +13:00
toofar b812ec2628 Ignore more 6.7 DIR_APP_DICTIONARIOES log messages
In the bleeding edge CI tests I'm seeing:

  IGNORED: Path override failed for key base::DIR_APP_DICTIONARIES and path '/__w/qutebrowser/qutebrowser/.tox/bleeding/lib/python3.11/sitePath override failed for key base::DIR_APP_DICTIONARIES and path '/__w/qutebrowser/qutebrowser/.tox/bleeding/lib/python3.11/site-packages/PyQt6/Qt6/libexec/qtwebengine_dictionaries'
  INVALID: -packages/PyQt6/Qt6/libexec/qtwebengine_dictionaries'

Where the second line looks like maybe spill over from the first one
that is for some reason being printed twice and interleaved! Maybe
different processes or threads?

I did a regex for "line ending with this and with no spaces in it" which
is hopefully safe enough to not pick up a wrong line accidentally.
2024-04-06 11:29:31 +13:00
Florian Bruhin 3d86d7876a Add role="switch" to default hints.selectors
See https://www.reddit.com/r/qutebrowser/comments/1bomb3h/closing_popups_within_a_webpage_and_toggling/
2024-03-27 23:58:36 +01:00
Florian Bruhin 9560d7355f Fix derp 2024-03-27 20:25:10 +01:00
Florian Bruhin 60ce2e6705 Add missing date to comment 2024-03-27 20:18:54 +01:00
Florian Bruhin 53e37cbf41 Update chromium versions 2024-03-27 20:15:15 +01:00
Florian Bruhin 713a4e5ec2 Fix caret tests on Qt 6 and Windows 2024-03-27 19:49:09 +01:00
Florian Bruhin 7a969a2d54 Add caret browsing debug logging 2024-03-27 16:55:18 +01:00
Florian Bruhin 481542844d tests: Avoid using autofocus for click_element tests
Similarly to the last commit (982b8bdcec),
we run into a race between autofocus triggering and the test trying to
click the focused element.

This also affects the "when there is none" test, which loses the focus
before it has been set, thus ending up with a focused element but expecting
none.

We fix both in one go by manually focusing things with a tab keypress
instead of using autofocus.

See #8145 and #5390.
2024-03-27 13:05:28 +01:00
Florian Bruhin 982b8bdcec Fix input.insert_mode.auto_load race / test_auto_load flakiness
Fixes #8145, see #5390.

As long as we don't have a solution to get notified about focus happening
(#2471 possibly?), it looks like there is no better way to get notified
about this, so a delay will need to do for now.
2024-03-27 12:34:30 +01:00
Florian Bruhin 0b220117e2 tests: Fix glob matching 2024-03-26 14:30:20 +01:00
Florian Bruhin f671e997cc tox: Avoid installing PyQt from source for bleeding envs
Right now, the Riverbank PyPI server has a PyQt5 sdist but no wheels.
2024-03-26 14:23:05 +01:00
Florian Bruhin 6ee7a23c7e tests: Ignore new SSL error message
Seems to break in bleeding edge tests
2024-03-26 14:15:09 +01:00
Florian Bruhin 0a5d92119e importer: Stop using deprecated bs4 findAll
Fails bleeding edge CI due to warnings
2024-03-26 14:09:09 +01:00
Florian Bruhin d37f5b7be0 Ignore already imported Qt module with PyInstaller
Starting with PyInstaller 6.5.0, it imports Qt bindings early, due to
this change: https://github.com/pyinstaller/pyinstaller/pull/8315

We warn about this in order to avoid unintentional early Qt imports in
qutebrowser. However, in the case of using PyInstaller, we just suppress
the warning now, as it's not us to blame.

See https://github.com/qutebrowser/qutebrowser/pull/8123
2024-03-26 13:57:07 +01:00
Florian Bruhin 1ee138b681 qtutils: Handle QDataStream.Status.SizeLimitExceeded 2024-03-25 23:29:24 +01:00
Florian Bruhin a45cfb89cb tests: Add new ignored error messages 2024-03-25 23:05:25 +01:00
Florian Bruhin ad3ba9fe84 tests: Avoid accessing Qt statics at import time
With a Qt 6.7 developer build, the tests fail with:

    ASSERT failure in QtGlobalStatic::ApplicationHolder<QAS>::PlainType*
    QtGlobalStatic::ApplicationHolder<QAS>::pointer() [with QAS =
    {anonymous}::Q_QAS_qtlsbLoader; PlainType = QFactoryLoader]: "The
    application static was used without a QCoreApplication instance", file
    .../qtbase/src/corelib/kernel/qapplicationstatic.h, line 54

    Fatal Python error: Aborted

    [...]

    Current thread 0x00007c18bb3f3740 (most recent call first):
    File ".../tests/unit/browser/webkit/test_certificateerror.py", line 23 in <module>

See https://codereview.qt-project.org/c/qt/qtbase/+/495239
2024-03-25 23:05:16 +01:00
Florian Bruhin 01f4807eaf mypy: Set local_partial_types = True
This is going to be default behavior in mypy 2.0, see:

- #8123
- https://mypy-lang.blogspot.com/2024/03/mypy-19-released.html
- https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-local-partial-types
2024-03-25 12:15:03 +01:00
toofar 52c83cf485
Merge pull request #8142 from qutebrowser/update-dependencies
Update dependencies
2024-03-25 19:14:04 +13:00
toofar 17ddde3f72 Add changelog URLs
jaraco added some utility libraries they maintain to the keyring package
that they also maintain.

Also update changelog URLs to be consistent since they have a "skeleton"
project which lays everything out and publishes all their projects the
same. Should we be preferring GH or RTD links? idk
2024-03-25 18:41:46 +13:00
qutebrowser bot d0eac83676 Update dependencies 2024-03-25 04:21:29 +00:00
toofar 01de692348
Merge pull request #8124 from qutebrowser/dependabot/github_actions/softprops/action-gh-release-2
build(deps): bump softprops/action-gh-release from 1 to 2
2024-03-25 13:04:02 +13:00
toofar a795164da4
Merge pull request #8123 from qutebrowser/update-dependencies
Update dependencies
2024-03-25 12:20:33 +13:00
toofar 75c991b998 update importlib metadata changelog URL
See 2f3d0161f3 for the corresponding importlib_resources one.
Also this I guess? I don't really understand it, everything seems happy. https://github.com/python/importlib_metadata/issues/459
2024-03-25 11:49:20 +13:00
Florian Bruhin 93b8438ebc Update doc heading for Windows
See #8136
2024-03-22 16:03:06 +01:00
qutebrowser bot ab9e575ab9 Update dependencies 2024-03-18 04:21:00 +00:00
dependabot[bot] 201a533b4d
build(deps): bump softprops/action-gh-release from 1 to 2
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-11 18:29:51 +00:00
Florian Bruhin c073412b49 Rename readme_renderer in changelog URLs 2024-03-04 21:28:47 +01:00
qutebrowser bot e02e709d7c Update dependencies 2024-03-04 19:16:02 +00:00
Florian Bruhin f0d3130aae
Merge pull request #8114 from qutebrowser/update-dependencies
Update dependencies
2024-02-26 11:16:30 +01:00
toofar 2f3d0161f3 Update lint etc for dependencies
The lint ones are:

    linters (pylint): qutebrowser/completion/completionwidget.py#L440
    Consider using 'height = min(height, contents_height)' instead of unnecessary if block

    linters (pylint): qutebrowser/browser/webengine/webview.py#L241
    Useless suppression of 'no-member'

The no-member one might be due to this change: https://github.com/pylint-dev/pylint/issues/9246

For the importlib-resources one, I'm not sure why it's changed to be
underscore instead of a dash now. But at least it's consistent across
all the requirements files now!

I feel like I've seem this in a previous dependancy update too (for a
different package?) but I can't find that now.
2024-02-26 19:22:27 +13:00
qutebrowser bot 52f5147666 Update dependencies 2024-02-26 04:20:13 +00:00
toofar f6b8275f0c
Merge pull request #8106 from qutebrowser/update-dependencies
Update dependencies
2024-02-25 17:39:48 +13:00
toofar 4f91fc4025
Merge pull request #8110 from tarneaux/main
Allow reloading config on SIGHUP
2024-02-25 16:56:15 +13:00
toofar 42cf53ae7c ci: don't fail all docker builds if one fails
Currently the unstable docker images are failing to build
(undefined symbol: _ZN5QFont11tagToStringEj, version
Qt_6. Looks like Qt has upgraded to 6.7 but pyqt6 hasn't been patched to
remove some symbols that are gone now).

But we might as well let the stable ones rebuild right?
2024-02-25 16:52:32 +13:00
toofar 5687177d4d ci: fix --debug patching on all platforms (for real?)
It seems `sed -i` is not very portable. Initially we were using this
command:

    sed -i '' '/.-d., .--debug.,/s/$/ default=True,/' qutebrowser/qutebrowser.py

and then that started breaking on windows, I'm not sure why, with "can't
read /.-d., .--debug.,/s/$/ default=True,/: No such file or directory".
Then we changed to:

    sed -i '/.-d., .--debug.,/s/$/ default=True,/' qutebrowser/qutebrowser.py

so without the extension argument, but that broke on mac with "1:
"qutebrowser/qutebrowser.py": extra characters at the end of q command"

then we tried:

    sed -i'' '/.-d., .--debug.,/s/$/ default=True,/' qutebrowser/qutebrowser.py

and that also broke on mac with the same error. On the recommendation of
stackoverflow I just changed it no not use in-place editing and do a
good old fashioned move afterwards. https://unix.stackexchange.com/questions/92895/how-can-i-achieve-portability-with-sed-i-in-place-editing

... record scratch ...

Apparently these GHA steps are being run in powershell in windows where
`mv` is implemented by `Move-Item` where you have to use -Force to
overwrite destination files.

But that's not portable. cp does happily overwrite without any
additional instruction though. So I'm doing cp instead of mv and then
removing the temp file.

Probably if this drags out anymore we should download something off of
pypi which is platform independent to handle it.
2024-02-25 16:30:27 +13:00
toofar 145bfe4de0 windows doesn't support SIGHUP
It gives an AttributeError for both signal.SIGHUP and
signal.Signals.SIGHUP. The Signals Enum is set up so you can use the
strings to key into it though, so that's nice. I was tempted to use a
walrus operator here but I think that's python 310 and I don't remember
what our minimum supported version is.
2024-02-25 15:56:34 +13:00
toofar 6050017809 update changelog for SIGHUP handling 2024-02-24 23:23:42 +13:00
toofar f6c0e4ebc8 Add some basic tests for SignalHandler
It doesn't look like this class has any unit tests currently. And since
we are adding a new signal handler to it I took the opportunity to add a
few tests to it to establish a bit of a framework so that next time we
touch it it will be easier to add more.

I didn't go for full coverage here. It's an improvement over what was
there previously and it should make merging more palatable. I don't
think handling SIGHUP is a very risky feature.

I chose to use mocker.patch over monkeypatch.setattr because I think it
provides a more friendly and powerful API due to being more tightly
integrated with magic mocks. And with `mocker.patch.object` you can even
use actual object names instead of strings, the same as monkeypatch
allows.

One thing I'm less confident with here is mocking all multiple things in
a couple of fixtures. Writing one fixture for each little thing I mock
doesn't feel appealing to me right now, but for mocks that tests need to
access there isn't really any idiomatic way to let the tests access
them. I previously just had the one fixture but pulled out the read
config one for that purpose. It's a pattern I'll have to think on a bit
I think. Probably having to have developers thing about the balance of
boilerplate vs accessibility is cognitive load that we want to avoid.
Hmm.

Anyway, here are the options I was looking at to let test code access
mocks that where all shoved away into the one fixture:

1. group the tests into a class and put the mocks in class variables:
   could work fine but I don't think it's very idiomatic for pytest?
2. return some kind of meta object from the fixture that has the object
   under test as one attribute and the mocks as other ones: hmm,
   returning multiple values from a method always seemed a bit smelly to
   me
3. make one fixture for each of the mocks, have the main fixture depend
   on them all, tests that need to modify them can depend on them too:
   writing all those fixtures seems tedious and I don't think it would
   be a clear win in terms of readability. *sigh*, I suppose I should
   pull the ones I'm modifying out at least so other people don't copy
   my lazyness in the future
4. have the test code access the mocks from the real code, eg
   `configfiles.sys.exit.side_effect = ...`: this works fine but I feel
   like it's relying on an implementation detail and probably shouldn't
   be encouraged? Not sure

In case anyone is struggling with git blame and wondering what the
QSocketNotifier stuff is about, this commit should explain it: 210ce8ca7c
2024-02-24 23:23:42 +13:00
tarneo aafb44cbaa
Run message.error() on SIGHUP config errors 2024-02-22 11:27:52 +01:00
tarneo d5926756ae
Replicate config_source in SIGHUP handler 2024-02-22 11:21:20 +01:00
tarneo 566c07c789
Allow reloading config on SIGHUP
Before this commit qutebrowser would just exit when receiving a SIGHUP.
Now it will reload the config using the bare config_source function, just like
the :config-source command does.
Closes #8108.
2024-02-21 21:15:10 +01:00
toofar e6a0d2bf2f Ignore new 6.6.2 notifications related error messages
The seem to be non-fatal considering the test scenarios they are coming from
are still passing.
2024-02-20 18:45:33 +13:00
qutebrowser bot 569716bef5 Update dependencies 2024-02-19 04:20:46 +00:00
toofar b92f053350
Merge pull request #8101 from qutebrowser/update-dependencies
Update dependencies
2024-02-17 09:58:40 +13:00
Florian Bruhin da2c7ee7cd ci: Try more sed cross-platform madness 2024-02-13 16:44:03 +01:00
qutebrowser bot 5615d0e59b Update dependencies 2024-02-12 04:20:45 +00:00
Florian Bruhin e42c3222b1
Merge pull request #8091 from qutebrowser/dependabot/github_actions/peter-evans/create-pull-request-6
build(deps): bump peter-evans/create-pull-request from 5 to 6
2024-02-05 20:12:22 +01:00