Commit Graph

268 Commits

Author SHA1 Message Date
George Edward Bulmer
ca8d935cf4 Update tests as per code review 2018-02-13 18:38:27 +00:00
Jay Kamat
11e04c79f4
Add add/remove tests to benchmarks 2018-02-10 15:10:33 -05:00
Florian Bruhin
20d5b4e384 Update pytest log handling
In pytest 3.4, we now need to explicitly set the log level and caplog.at_level
now sets the level of the root handler.
2018-02-06 23:17:40 +01:00
Florian Bruhin
6f028e9ad0 Update copyright years 2018-02-05 12:19:50 +01:00
Florian Bruhin
e76732693c Fix wrong import order 2017-12-15 14:35:07 +01:00
Florian Bruhin
2a8b74cbec Get rid of FakeUrl stub
We can just use a real QUrl...
2017-12-11 07:10:17 +01:00
evanlee123
9685eb36b6
Changed FakeUrl's url command to toDisplayString 2017-12-07 16:30:34 -07:00
unknown
25526f00bf fixed catch error in tabwidget 2017-12-07 15:47:03 -07:00
evanlee123
18609f1a24
fixed spacing on FakeURL 2017-12-07 02:36:31 -07:00
evanlee123
4d13941290
added the scheme field to FakeURL 2017-12-06 23:57:19 -07:00
Florian Bruhin
2cdc32ca58 Remove pytest-catchlog 2017-12-04 16:55:57 +01:00
Florian Bruhin
7520a365eb Update comments 2017-11-26 19:43:49 +01:00
Ryan Farley
650b0051e6 remove useless ignores 2017-11-26 01:59:21 -06:00
Ryan Farley
5ed8019115 update flake8 and flake8-deprecated
Updated requirements and adjusted the configuration in `.flake8`; other
files have been modified where the lack of per-file auto-ignore caused
problems, where putty's `# flake8: disable=` syntax could be replaced
with a simpler `noqa`, or where pylint directives already suppressed the
same error.
2017-11-26 00:16:14 -06:00
Florian Bruhin
a451e8ac9d Add a cache_tmpdir fixture 2017-11-21 14:09:30 +01:00
Florian Bruhin
203233c894 Track the view correctly in the webengineview fixture
This makes sure the view is closed after the test (fixing test_none on AppVeyor)
and also makes sure we have a QApplication.
2017-11-20 20:47:40 +01:00
Florian Bruhin
5e20aa668a Merge remote-tracking branch 'origin/pr/3262' 2017-11-19 14:24:48 +01:00
Jay Kamat
5913552dfe
Fix style issues in stylesheet tests 2017-11-13 19:57:11 -05:00
Florian Bruhin
f6cc6677dd Remove hiding of commands
This was often confusing for people - let's instead just hide commands which are
not available in normal mode.
2017-11-13 09:02:16 +01:00
Jay Kamat
d39dda38ce
Refactor CallbackChecker into test utils 2017-11-10 12:27:00 -05:00
Jay Kamat
e7fdff5632
Implement basic stylesheet tests 2017-11-09 14:44:32 -05:00
siddhugolu
4862b2faf9 modified pylint pragmas 2017-10-22 23:52:35 +05:30
Florian Bruhin
cce4ff6d53 Merge remote-tracking branch 'origin/pr/3054' 2017-10-17 09:10:45 +02:00
Florian Bruhin
3797b0cfed Merge remote-tracking branch 'origin/pr/3034' 2017-10-16 08:12:15 +02:00
Kimat Boven
8ca0c87b1f FakeUrl had no url 2017-10-14 22:14:01 +02:00
Joakim Reinert
7c584e7b6c add optional interval argument to start function of Timer stubs
Fixes failing tests for completer
2017-10-12 13:02:37 +02:00
Michael Hoang
249e497d36 Add test for window completion 2017-10-11 17:18:13 +11:00
Florian Bruhin
cdf0cf56fa Merge remote-tracking branch 'origin/pr/3056' 2017-10-04 06:45:08 +02:00
Ryan Roden-Corrent
4a9e22163b Filter keyhints based on count prefix.
If a count prefix is given, only hint commands that can take a count.
2017-10-03 22:15:21 -04:00
Florian Bruhin
9383452ab9 Use a real YAML config for config tests 2017-10-03 13:06:50 +02:00
Florian Bruhin
ed8c3f4aa2 Add :config-clear and :config-unset
See #2794
2017-10-03 12:45:39 +02:00
Florian Bruhin
4e46c34e5a Use .assert_not_called() for mocks 2017-09-22 19:58:38 +02:00
Florian Bruhin
fb33985f07 Merge remote-tracking branch 'origin/pr/2992' 2017-09-21 09:12:03 +02:00
Florian Bruhin
2a4f10f0f5 Add qapp for tabbed_browser_stubs 2017-09-20 11:30:18 +02:00
Florian Bruhin
3a5241b642 Start using attrs
Closes #1073
2017-09-19 22:21:45 +02:00
Felix Van der Jeugt
8db630d358
don't copy values but set dirty 2017-09-19 17:26:03 +02:00
Florian Bruhin
5298d14084 Move backend initialization to config.py 2017-09-18 23:01:17 +02:00
Florian Bruhin
852baaa8c3 Drop support for Qt < 5.7.1
See #2742
2017-09-18 23:01:17 +02:00
Florian Bruhin
2e8419db27 Fix lint 2017-09-15 17:24:39 +02:00
Florian Bruhin
3d3391b55e Clean up *_tmpdir fixtures 2017-09-15 14:32:03 +02:00
Florian Bruhin
fa4ea912c9 Get rid of init_standarddir fixture
Instead, always patch in tmpdir's so we don't write to qute_test folders.
2017-09-15 14:30:46 +02:00
Florian Bruhin
54dfc083f9 Remove default_config fixture 2017-09-15 14:13:27 +02:00
Florian Bruhin
c5c566aadc tests: Bump up timeout for CallbackChecker 2017-09-15 12:07:54 +02:00
Florian Bruhin
ad2598b475 Add initial support for standarddir.config(auto=True)
This doesn't actually migrate things yet.
See #2791, #383.
2017-09-13 17:26:56 +02:00
Florian Bruhin
40ee89bddc Initialize monospace fonts in tests properly
See #2825
2017-09-12 22:12:37 +02:00
Ryan Roden-Corrent
0286e9ddf2 Fix completion tests after config merge. 2017-08-20 21:12:38 -04:00
Ryan Roden-Corrent
5ea420b49b Fix startup crashes after config merge.
Get qutebrowser to the point where it can at least start

- Declare _messages earlier in MessageView.__init__ so it is set before
  the config trigger tries to access it.
- Remove unused configmodel completion functions
- Move bind completion to configmodel to avoid a circular import with
  the config module
- Fix some config accesses (forgot to use .val)
- Fix old Completion.CompletionKind references
2017-08-09 07:28:22 -04:00
Ryan Roden-Corrent
71b71dbc58 Merge remote-tracking branch 'upstream/master' into HEAD 2017-08-06 18:13:49 -04:00
Florian Bruhin
fba25338be Merge pull request #2295 from rcorre/really_complete
Completion refactor V3
2017-07-21 15:05:43 +02:00
Ryan Roden-Corrent
ea459a1eca SQL code review fixes.
- Ignore invalid variable name in flake8 (pylint already checks this and
  we don't want to have to double-ignore)
- Fix and test completion bug with `:set asdf `
- Remove unused import
- Use `assert not func.called` instead of `func.assert_not_called` for
  backwards compatibility
2017-07-12 08:19:31 -04:00
Florian Bruhin
e81dcccace Add a test for a None currentWidget with backforward widget 2017-07-10 09:29:45 +02:00
Florian Bruhin
0e8175b8eb Update docstrings/docs 2017-07-09 23:27:34 +02:00
Daniel Hahler
b3a9e09d6c Add statusline widget for back/forward indicator
Fixes https://github.com/qutebrowser/qutebrowser/issues/2737.
2017-07-09 22:38:44 +02:00
Ryan Roden-Corrent
cf4ac1a5b7 SQL code review changes.
- use mocker.Mock instead of mock.Mock to avoid an extra import
- attach model to validator sooner so it can validate changes in the
  model during the test
2017-07-08 16:34:38 -04:00
Ryan Roden-Corrent
f9f8900fe9 More sql code review fixes.
- remove outdated comment
- fix sql init error message
- clean up history text import code
- fix test_history file path in coverage check
- use real web history, not stub, for completion model tests
- use qtmodeltester in sql/list_category tests
- test url encoding in history tests
- fix test_clear by using a callable mock
- remove test_debug_dump_history_oserror as the check is now the same as
  for the file not existing
- rename nonempty to data in test_completionmodel
- add more delete_cur_item tests
- test empty option/value completion
2017-07-08 09:57:32 -04:00
Ryan Roden-Corrent
dc4472470e Merge remote-tracking branch 'upstream/master' into really_complete 2017-07-05 08:45:57 -04:00
Florian Bruhin
cff61fa0bc Fix pylint
This also reverts commit 8df0b063be.
2017-07-04 15:34:10 +02:00
Florian Bruhin
f98b8a240e Fix flake8 2017-07-04 15:09:23 +02:00
Florian Bruhin
8933b4c5da Avoid calling configdata.init() in tests
It takes unnecessary time (20ms without C extensions) to initialize it over and
over again - and for some reason, it takes 20s (!) on Travis.
2017-07-04 15:08:04 +02:00
Florian Bruhin
9dfe4429d7 Import qutebrowser.app in conftest 2017-07-04 15:08:04 +02:00
Florian Bruhin
d5cd0b19b0 Update test_basekeyparser for new config 2017-07-04 15:08:04 +02:00
Florian Bruhin
22b0f2fd24 Various simple test updates for new config
test_cache
test_cookies
test_webkitelem
test_cmdutils
test_runners
test_completionwidget
test_messageview
test_editor
test_miscwidgets
test_sessions
test_urlutils
test_utils
test_prompt
statusbar/test_*
test_cmdhistory
test_tabwidget
test_tab
test_downloads
test_networkmanager
2017-07-04 15:08:04 +02:00
Florian Bruhin
4495e721d8 Tests and fixes for config.Config 2017-07-04 15:08:03 +02:00
Florian Bruhin
2c3981e57e Get rid of Config.read_configdata()
No need for this indirection
2017-07-04 15:08:03 +02:00
Florian Bruhin
3edebce833 Add tests for :set 2017-07-04 15:08:03 +02:00
Florian Bruhin
725ffef5f3 Use a real config object in unit tests 2017-07-04 15:08:03 +02:00
Florian Bruhin
28670f8e48 Move config.style into config.config and refactor it 2017-07-04 15:08:03 +02:00
Florian Bruhin
81d6406e14 Update test_stylesheet 2017-07-04 15:08:03 +02:00
Florian Bruhin
a5c8a52dd5 Update config_stub for tests 2017-07-04 15:08:03 +02:00
Florian Bruhin
2ba637891a Add required_keys for configtypes.Dict 2017-07-04 15:08:03 +02:00
Florian Bruhin
2a40401398 Fix config tests for new Command type 2017-07-04 15:08:03 +02:00
Florian Bruhin
3e3685b68b Initial configexc refactoring 2017-07-02 22:17:33 +02:00
Ryan Roden-Corrent
22880926b1 Fix WebHistoryStub for delete argument change 2017-06-29 21:46:09 -04:00
Ryan Roden-Corrent
f06880c6e2 Fix history completion delete function.
In order to update SqlQueryModel's rowCount after re-running the query,
we must call setQuery again.
2017-06-27 08:42:10 -04:00
Ryan Roden-Corrent
46161c3af0 Refactor delete_cur_item.
Taking the completion widget as an argument was overly complex.
The process now looks like:

1. CompletionView gets deletion request
2. CompletionView passes selected index to CompletionModel
3. CompletionModel passes the row data to the owning category
4. The category runs its custom completion function.

This also fixes a bug. With the switch to the hybrid (list/sql)
completion model, the view was no longer updating when items were
deleted. This fixes that by ensuring the correct signals are emitted.

The SQL model must be refreshed by running the query. We could try using
a SqlTableModel so we can call removeRows instead.

The test for deleting a url fails because qmodeltester claims the length
of the query model is still 3.
2017-06-26 08:57:36 -04:00
Florian Bruhin
994e8c692f Merge different FakeTabbedBrowser objects 2017-06-20 15:19:53 +02:00
Ryan Roden-Corrent
6fc61d12fc Assorted small fixes for sql code review. 2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
309b6ba32c Move _import_history to history.py.
Also adjusts the history import test to operate at a higher level and
ensure the old text file is removed (or isn't, in the case of an error).
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
882da71397 Remove unused imports 2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
71191f10a2 Only complete most recent atime for url.
The history completion query is extended to pick only the most recent item for
a given url.

The tests in test_models now check for ordering of elements.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
de5be0dc5a Store history in an on-disk sqlite database.
Instead of reading sqlite history from a file and storing it in an in-memory
database, just directly use an on-disk database. This resolves #755, where
history entries don't pop in to the completion menu immediately as they are
still being read asynchronously for a few seconds after the browser starts.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
f95dff4d9e Decouple categories from completionmodel.
Instead of add_list and add_sqltable, the completion model now supports
add_category, and callees either pass in a SqlCategory or ListCategory. This
makes unit testing much easier.

This also folds CompletionFilterModel into the ListCategory class.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
56f3b3a027 Small review fixups for SQL implementation.
Respond to the low-hanging code review fruit:

- Clean up some comments
- Remove an acidentally added duplicate init_autosave
- Combine two test_history tests
- Move test_init cleanup into a fixture to ensure it gets called.
- Name the _ argument of bind(_) to _key
- Ensure index is valid for first_item/last_item
- Move SqlException to top of module
- Rename test_index to test_getitem
- Return QItemFlags.None instead of None
- Fix copyright dates (its 2017 now!)
- Use * to force some args to be keyword-only
- Make some returns explicit
- Add sql to LOGGER_NAMES
- Add a comment to explain the sql escape statement
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
a774647c26 Get test_models mostly working again.
- Adjust _check_completions to work for CompletionModel and SqlCompletionModel
- Move sql initialization into a reusable fixture
- Remove the bookmark/quickmark/history stubs, as they're now handled by sql
- Disable quickmark/bookmark model tests until their completion is ported to
  sql.
- Disable urlmodel tests for features that have to be implemented in SQL:
    - LIMIT (for history-max-items)
    - Configurable column order (for quickmarks)
    - Configurable formatting (for timestamp-format
2017-06-19 07:42:12 -04:00
Florian Bruhin
c4fb2bc609 Fix URL/renderer crash tests with Qt 5.9
The behavior in Qt changed there (in a good way), so we need to adjust the tests
accordingly.

Fixes #2514
2017-05-19 08:10:17 +02:00
Florian Bruhin
c6e31391de Fix most tests/lint 2017-05-10 09:19:24 +02:00
Florian Bruhin
822623f2ed Finally update copyrights... 2017-05-09 21:37:03 +02:00
Florian Bruhin
1d0f187fab Adjustments for new pylint version 2017-04-13 18:22:16 +02:00
Florian Bruhin
ca4f249c30 Use three-argument form of monkeypatch.*attr 2017-03-01 11:33:41 +01:00
Florian Bruhin
6004bfa72f Don't lose warnings shown in early init phases 2017-02-23 06:48:58 +01:00
Florian Bruhin
b1a95a3930 Add automatic backend selection in earlyinit 2017-02-05 17:09:04 +01:00
Maciej Wołczyk
2fca442892 Fixed TabbedBrowserStub's tabBar, no longer toggling updates while moving tabs 2016-11-30 15:23:35 +01:00
Maciej Wołczyk
e613d01263 Fixed problems with tab completion after moving tabs (#2141) 2016-11-30 14:17:20 +01:00
Florian Bruhin
d64efa6b9b Fix test_tabwidget 2016-11-15 23:40:24 +01:00
Florian Bruhin
b4872192c3 Merge branch 'more-tests' of https://github.com/HolySmoke86/qutebrowser into HolySmoke86-more-tests 2016-10-30 23:24:15 +01:00
Florian Bruhin
ece3f3a2e1 Update to pytest-qt 2.1.0 2016-10-26 07:42:41 +02:00
Daniel Karbach
863bab3ccf allow multiline matches in log messages 2016-10-24 17:10:47 +02:00
Florian Bruhin
e32bbfa8f7 Init message.global_bridge at import time 2016-09-15 14:51:22 +02:00
Florian Bruhin
43a5c46d82 Don't use @pyqtSlot for MessageMock 2016-09-15 14:51:22 +02:00
Florian Bruhin
a2254b671c Adjust tests/messagemock 2016-09-15 14:51:21 +02:00