Commit Graph

139 Commits

Author SHA1 Message Date
Florian Bruhin 85b867fe8d Merge remote-tracking branch 'origin/pr/7096' 2022-06-13 12:34:33 +02:00
Florian Bruhin 8ac522cf55 Fix lint 2022-05-20 12:39:52 +02:00
Florian Bruhin 15dc5e81f7 tests: Improve TestSanitizeFilename
Those special cases were only tested by Hypothesis before
2022-05-20 11:01:46 +02:00
Nicholas Schwab e7cf3e41bc Add more unit tests. 2022-04-08 14:00:57 +02:00
Nicholas Schwab c48719f014 Fix missing conversion to str in unit test hypothesis. 2022-04-08 14:00:39 +02:00
Nicholas42 d8af9617d9
Simplify unit test for click-element.
Co-authored-by: Florian Bruhin <me@the-compiler.org>
2022-04-08 13:54:30 +02:00
Nicholas Schwab ae61f02831 Add parse_point utility and tests for it. 2022-04-06 19:37:54 +02:00
Florian Bruhin da280df809 Clean up some remaining Python version references 2022-04-04 10:51:34 +02:00
Florian Bruhin 1547a48e6f tests: Adjust for PyYAML 6.0 2021-10-14 09:05:25 +02:00
Florian Bruhin 2047218361 Revert "Fix enum stringification for Python 3.10 a7+"
This reverts commit e2c5fe6262.
See https://mail.python.org/archives/list/python-dev@python.org/thread/ZMC67QA2JVQJSWSFWRS6IM6ZX4EK277G/#LSTMFAPSPD3BGZ4D6HQFODXZVB3PLYKF
2021-07-12 16:03:41 +02:00
Florian Bruhin e2c5fe6262 Fix enum stringification for Python 3.10 a7+
https://bugs.python.org/issue40066
https://mail.python.org/archives/list/python-dev@python.org/message/CHQW6THTDYNPPFWQ2KDDTUYSAJDCZFNP/
b775106d94
2021-04-08 09:51:16 +02:00
Florian Bruhin c3d1b71c6f Handle version numbers with >3 digits
Closes #6354
2021-04-07 13:23:12 +02:00
Florian Bruhin 952402066d tests: Move flatpak patch to conftest 2021-03-31 13:10:09 +02:00
Florian Bruhin 40c72f849d flatpak: Skip download dispatcher tests 2021-03-31 13:10:09 +02:00
Florian Bruhin d31d63cc68 tests: Move freezer to fixtures.py 2021-03-29 23:42:14 +02:00
Lembrun 0d199a7770 Merge branch 'master' into pathlib-/unit/utils 2021-03-23 20:29:11 +01:00
Lembrun 612d00f7ab Reverting to abspath,minor simplifications 2021-03-18 23:21:55 +01:00
Florian Bruhin 3309ee65ed Drop libgl workaround entirely 2021-03-17 21:02:40 +01:00
Lembrun ac3603a2e2 Replaced os.path by pathlib in tests/unit/utils 2021-03-16 20:24:10 +01:00
Florian Bruhin 01b57a33be Merge remote-tracking branch 'origin/pr/6234' 2021-03-11 17:23:51 +01:00
Florian Bruhin aa3036dad5 Fix long lines 2021-03-11 17:08:49 +01:00
Florian Bruhin 4709d46936 Add custom VersionNumber class
Qt's API is kind of painful, and we need some custom functionality
anyways. Wrap QVersionNumber with our own class instead of piling up
workarounds.
2021-03-11 16:45:40 +01:00
Lembrun 3d01c201b8 Added test_resources.py 2021-03-09 21:33:39 +01:00
Lembrun a015e2603b Added utils/resources.py and changed calls to util.read_file* 2021-03-07 17:52:42 +01:00
Florian Bruhin 57651f8b10 Add :screenshot command
See #1841 and #2146
2021-02-10 17:50:02 +01:00
Florian Bruhin f8692cb141 Add more tests 2021-02-10 16:13:22 +01:00
Florian Bruhin ad96f4b954 utils: Adjust tests for subdir globbing 2021-01-30 16:08:49 +01:00
Florian Bruhin a7d4164d73 Add tests/changelog
See #6086
2021-01-30 15:45:11 +01:00
Florian Bruhin 54bcdc1eef Fix resource globbing with Python .egg installs
When qutebrowser is installed as an .egg (like can happen with setup.py
install), importlib.resources.files(...) can return a zipfile.Path in
place of a pathlib.Path.

Unfortunately, those path objects don't support .glob(), nor do they
support things like .relative_to() or .as_posix(). Thus, if that's the
case, we need to implement our own poor globbing based on
.iterdir() (which they *do* support).
2021-01-28 15:01:29 +01:00
Florian Bruhin a5063283de Separate utils.read_file and read_file_binary
See #4467
2021-01-26 17:49:39 +01:00
Florian Bruhin 579585d554 Get rid of utils.resource_filename
See #4467
2021-01-26 17:47:38 +01:00
Florian Bruhin 1a4fff1a42 doc: Switch URLs to https 2021-01-26 15:19:01 +01:00
Florian Bruhin 86863f8cd4 tests: Update properly for importlib_resources
See #4667
2021-01-26 10:17:25 +01:00
Florian Bruhin 222f1f19a1 Bump copyright years
Closes #6015
2021-01-20 20:06:19 +01:00
Axel Dahlberg 2d6d1dad43 Clearer assertions, updated tests to assert correct errors 2021-01-18 12:57:22 +01:00
Axel Dahlberg 799b0fb5c6 Test when cleanup_file context fails 2021-01-17 14:40:53 +01:00
Axel Dahlberg ed2c3ea451 Update to test cleanup file context and ignore cover 2021-01-17 13:24:49 +01:00
Axel Dahlberg 01642605d5 Cleanup file context and tests 2021-01-17 12:53:19 +01:00
Florian Bruhin ebb3046822 Add overrides for mimetype -> extension conversion
Python 3.6 gets some of those "wrong":
https://bugs.python.org/issue1043134

This has been fixed in Python 3.7:
https://github.com/python/cpython/pull/14375

The override dict has been generated by copying the types_map from the
current git master:
https://github.com/python/cpython/blob/v3.10.0a3/Lib/mimetypes.py#L414-L547

And then running the following with Python 3.6:

    import mimetypes

    reverse = {}
    for ext, mimetype in types_map.items():
        if mimetype not in reverse:
            reverse[mimetype] = ext
    assert reverse['text/plain'] == '.txt'

    for mimetype, ext in reverse.items():
        got = mimetypes.guess_extension(mimetype)
        if got != ext:
            print(f'    "{mimetype}": "{ext}",  # not {got}')
2021-01-05 11:19:15 +01:00
Marco Zatta 5f93c1a68a Added tests and modifed regex to full match 2020-12-08 19:56:44 +01:00
Marco Zatta cc360cd4a3 Parse_duration with one regex only 2020-12-08 19:10:04 +01:00
Marco Zatta 96b997802e Time units added to :later command
The :later command is modified to accept either an integer or time
duration with properly formatted units.
The expected format is XhYmZs, where X, Y and Z are integers
corresponding to hours, minutes or seconds respectively.
The user needs to specify at least one of the units for the command to
work.
In case of integer input, unit is assumed to be seconds.
2020-12-07 19:12:19 +01:00
Florian Bruhin bedc9f7fad Move utils.interpolate_color to qtutils
This avoids a circular import between utils and qtutils, which, while
unproblematic, was easy to fix.

Also, qtutils is actually a better fit here, because we're dealing with
QColor objects anyways.
2020-11-20 11:17:24 +01:00
Florian Bruhin 46e6839e21 Replace pkg_resources.parse_version by QVersionNumber
Partially addresses #4667.
Supersedes #5768, #5852, #5893
See #5495
2020-11-20 10:54:42 +01:00
Florian Bruhin 6e972dbe14 Merge remote-tracking branch 'origin/pr/5860' 2020-11-05 13:20:18 +01:00
Florian Bruhin bcb8b5dd70 old qt: Remove unused imports 2020-11-04 18:30:04 +01:00
Florian Bruhin c95b9637e1 old qt: Remove old inspector logic 2020-11-04 11:30:54 +01:00
duthades 767f34a353 write test cases for interpolate_color with alpha 2020-11-03 17:23:56 +05:30
Florian Bruhin 46302e488f Use enum.auto() for most enum values
Doesn't change values where they are chosen to line up with Qt enums.

See #4800
2020-10-26 15:50:54 +01:00
Yegor b2dd22c5e9 Use class-based API instead of functions for enums 2020-10-09 20:04:49 +03:00