Commit Graph

80 Commits

Author SHA1 Message Date
Dave Dalcino
7c0de86f78 Add tests for sdktool: install-tool and list-tool 2023-05-24 15:38:13 -07:00
Dave Dalcino
b8222a4a4f Test resilience to missing wasm Updates.xml files
Makes sure that MetadataFactory can still produce a list of
architectures when the standard Updates.xml file is present, but the
expected wasm Updates.xml file is not. This should prevent failures
in the future if the Qt devs decide to change the way WASM works, as
they did with Qt 6.5.0.
2023-02-11 13:31:32 -08:00
Dave Dalcino
e3c7d14c3f Add tests for qt 6.5.0 wasm 2023-02-11 10:35:48 -08:00
Dave Dalcino
24f6d9ddca Add cli tests for long_modules and modules with archives
This should cover the new lines of uncovered code in this PR.
2022-11-21 07:34:46 +09:00
Hiroshi Miura
1dbd73450a Adjust code scanner warnings
- Replace map+filter and list+filter with list comprehension expression
- Use try/except for next(Iterator)
- Add test case for altlink that cause exception on next() in get_altlink
- Avoid exit but use sys.exit

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2022-11-21 07:34:45 +09:00
Dave Dalcino
452f8d74b2 Fix mypy type errors
- Introduce classes inherit argparse.ArgumentParser to suppress mypy
  errors in Cli class.
- `requests.session.Session.get()` expects that `timeout` is `float | tuple[float, float] | tuple[float, None] | None`
  so use `Tuple[float, float]` for timeout
- Use named tuple for modules_query
- Update test_list.py
2022-11-21 07:34:45 +09:00
Dave Dalcino
81eebde168 Adjust against mypy type errors 2022-11-20 15:20:27 +09:00
Dave Dalcino
3dab855941 reduce uncovered lines 2022-11-16 16:14:55 -08:00
Dave Dalcino
c90b262984 remove extensions from ArchiveId 2022-11-16 16:14:55 -08:00
Dave Dalcino
caee04bcb3 Remove extensions 2022-11-16 16:14:54 -08:00
Dave Dalcino
703f2d2fe3 rework logic for readability 2022-08-20 09:09:23 -07:00
Dave Dalcino
78fe5f30eb Improve unit test coverage 2022-08-20 09:04:40 -07:00
Dave Dalcino
f0a48068ba Add function to select default installed mingw architecture 2022-08-20 07:52:56 -07:00
Dave Dalcino
910159f618 Add function to choose default desktop architecture 2022-08-20 07:52:39 -07:00
Hiroshi Miura
4ea02ebe07 Merge pull request #550 from ddalcino/fix-suggested-action-exception
Fix kwargs passed up AqtException inheritance tree
2022-08-12 23:06:49 +09:00
Hiroshi Miura
d30618791c Merge pull request #547 from ddalcino/list-qt-desc-modules
Add `aqt list-qt --long-modules`
2022-08-12 22:57:04 +09:00
Dave Dalcino
d867f417a3 rename new test 2022-08-11 21:52:57 -07:00
Dave Dalcino
0650ac9283 Improve testing of connection/download/checksum exceptions
This adds a new test that recreates #546
2022-08-11 21:40:39 -07:00
Dave Dalcino
a94717aa32 Tests for aqt list-qt --long-modules 2022-08-08 17:48:44 -07:00
Dave Dalcino
9bc8b553ee Refactor ToolData into reusable TableMetadata class 2022-08-08 17:41:11 -07:00
Dave Dalcino
9422b9fc67 Make MetadataFactory respect baseurl set in arguments 2022-08-07 11:27:31 -07:00
mite-user
53395ec326 Remove "test_list_bad_html()"
"test_list_bad_html()" expects error on unexpected html structure.
This error no longer occurs because html is handled differently
after the last 2 commits.
2022-07-21 18:37:10 +03:00
mite-user
640f81714b Add tests for the previous commit
Each ".html" isn't handled properly by the code before the previous commit.

"mirror-pre-a.html"
https://qtproject.mirror.liquidtelecom.com/online/qtsdkrepository/windows_x86/android/
No "<table>".

"mirror-table-before-pre-a.html"
https://ftp1.nluug.nl/languages/qt/online/qtsdkrepository/windows_x86/android/
"<table>" which doesn't contain folder names.

"mirror-first-td.html"
https://mirrors.dotsrc.org/qtproject/online/qtsdkrepository/windows_x86/android/
"<a>" is in the first "<td>", not second.

"mirror-tag-in-a.html"
https://mirrors.sjtug.sjtu.edu.cn/qt/online/qtsdkrepository/windows_x86/android/
There are other elements besides folder name inside the contents of "<a>".
2022-07-21 18:37:10 +03:00
Mozi
60889b7296 Log: left align the level name with padding (#539)
* Change log format for brief

- prepend %(levelname)s:

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* Update test expectations for error/warning messages

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* log: left align the level name with padding

Why 8: sizeof("CRITICAL") == 8

Ref:
  printf-style String Formatting § Built-in Types — Python 3 documentation
  https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting

* log: remove the duplicate "warning" words

Co-authored-by: Hiroshi Miura <miurahr@linux.com>
2022-07-18 22:29:16 +09:00
Dave Dalcino
e8672f3fbe Allow MetadataFactory to recover from bad HTML files
This change allows MetadataFactory.iterate_folders to recognize when
MetadataFactory has retrieved a malformed HTML file, or an HTML file
that does not contain the table and rows that it expects to see.

If the URL is correct, it should retrieve the right page, but this is
not guaranteed, and MetadataFactory should be able to recover and
generate an appropriate error message.

One possible situation where this kind of error might occur could be
when the user is connected to a public WIFI network, but not logged in.
The router would redirect aqt to the network login page, and aqt would
have no way of knowing that it did not receive the correct page.
Aqt should be resilient to this kind of error.
2022-04-19 18:26:21 -07:00
David Dalcino
b62db9ee2a Allow MetadataFactory.fetch_http to skip sha256
`MetadataFactory.fetch_http` must often download HTML pages, not
Updates.xml files. download.qt.io does not store checksums for these
files, so this particular function must be allowed to download these
pages without using a checksum.
2022-03-06 18:16:37 -08:00
David Dalcino
be23b62549 Update tests to require proper checksums 2022-03-06 17:56:25 -08:00
David Dalcino
092d4e8c02 Add tests for list-src, list-doc, list-example 2021-11-23 11:08:07 -08:00
David Dalcino
7104dbcdf7 Merge remote-tracking branch 'upstream/master' into add-list-qt-archives 2021-09-20 18:49:46 -07:00
David Dalcino
f78013d361 Improve suggested follow-up for --modules flag 2021-09-17 16:14:49 -07:00
David Dalcino
b67749e4fc Add tests 2021-09-17 14:48:57 -07:00
David Dalcino
f037a96457 Raise ArchiveListError where appropriate 2021-09-17 09:53:35 -07:00
David Dalcino
49cde4ee30 fix test error 2021-09-17 08:32:49 -07:00
David Dalcino
2c7e0a157d Add failing tests to list archives 2021-09-17 08:31:14 -07:00
David Dalcino
1a918c35c5 Merge remote-tracking branch 'upstream/master' into specify-version-by-simplespec 2021-09-09 08:26:10 -07:00
Hiroshi Miura
320a20abb2 Merge pull request #385 from ddalcino/improve-error-handling
Improve error handling
2021-09-08 15:46:17 +09:00
David Dalcino
5a1aedb480 Add functions to determine extensions
This moves the logic for determining extensions out of the QtArchive
class so that it is available elsewhere and does not need to be
duplicated.
2021-09-07 14:27:51 -07:00
David Dalcino
a380f5c1ea Allow list-qt to describe Qt 6.2 wasm target
On August 19, the Qt repo added a new wasm release for Qt 6.2.0.
`list-qt` currently prints that the `wasm` extension is available for
that version of Qt, but it will not let the user use it to query
modules and architectures, because of a hardcoded version check.
This change rewrites the version check so that a user may make queries.
2021-09-01 13:38:09 -07:00
David Dalcino
f63fcc5c79 Add AqtException base exception class
This also moves the `format_suggested_follow_up` function into the new
AqtException class, refactors `show_list` to use the new exceptions,
and tests the new code appropriately.
2021-09-01 11:42:45 -07:00
David Dalcino
8bc7cc3bf3 Add addons. test for metadata module 2021-08-17 15:39:34 -07:00
Hiroshi Miura
6ce29982b3 Merge pull request #359 from ddalcino/add-test-install
Add 'tests/test_install.py'
2021-08-06 08:08:40 +09:00
David Dalcino
c95516ed8e Remove re.Pattern type hint
In Python 3.6, `re.Pattern` does not exist, and using it as a type hint
causes the tests to fail. This change enables the tests to run on
Python 3.6.
2021-08-04 15:43:56 -07:00
Hiroshi Miura
a767956a5b Coding style update by Black/isort
Change to max line length to 125

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-08-02 13:41:41 +09:00
David Dalcino
f590ff78ef black 2021-07-22 11:41:32 -07:00
David Dalcino
08a0ad0182 Add test, impl for optional 'tools_' prefix 2021-07-22 11:36:06 -07:00
David Dalcino
fd8bebdad2 Restored ommitted TypeError check 2021-07-22 11:34:39 -07:00
David Dalcino
b23755ac5c Cleanup Versions test
This turns repetitive code into data
2021-07-22 10:16:19 -07:00
David Dalcino
9e0f2064ca test improvements 2021-07-22 09:48:01 -07:00
David Dalcino
bca85d1460 add tests for Cli.run_list_qt/Cli.run_list_tool 2021-07-22 09:48:01 -07:00
David Dalcino
353ee1e39d refactor test_list_qt_cli 2021-07-22 09:48:00 -07:00