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
Florian Bruhin
54c32cc74e
Fix long line
2016-09-12 20:41:51 +02:00
Florian Bruhin
e6680c3c60
Also redirect $HOME for QtWebEngine tests
...
See https://github.com/The-Compiler/qutebrowser/pull/1637#issuecomment-243043811
2016-09-12 19:55:31 +02:00
Florian Bruhin
2df971a79c
Move short_tmpdir fixture to conftest.py
2016-09-09 18:46:51 +02:00
Florian Bruhin
78d64f4791
Get rid of webkitelem.focus_elem
2016-09-07 11:24:28 +02:00
Florian Bruhin
ee5a972069
Move auto-insert-mode handling to browsertab
...
This means auto-insert-mode now works correctly with QtWebEngine.
2016-09-07 10:24:27 +02:00
Florian Bruhin
1e0f97b64d
pylint: Disable invalid-name in helpers/fixtures
2016-09-05 21:32:45 +02:00
Florian Bruhin
7592345b6e
Make unittests work without QtWebKit
2016-09-05 18:45:50 +02:00
Florian Bruhin
df3733af54
tests: Use pytest.fixture instead of yield_fixture
...
See #1877
2016-08-22 07:40:24 +02:00
Florian Bruhin
4658bdcacf
Use pytest.approx in tests.helpers.utils
...
See #1877
2016-08-22 07:39:11 +02:00
Florian Bruhin
7dadc28eb7
Handle an immediate callback in CallbackChecker
2016-08-18 12:40:21 +02:00
Florian Bruhin
359d4dd427
tests: Add a callback_checker fixture
2016-08-18 12:40:21 +02:00
Florian Bruhin
cf7170a33b
Remove no longer needed webelem methods
...
The following methods were only used for hint labels and thus removed
now:
- document_element
- create_inside
- find_first
- set_inner_xml
- remove_from_document
- set_style_property
2016-08-17 14:44:49 +02:00
Florian Bruhin
b1227391c5
tests: Request mode_manager in fake_web_tab
...
Since we create a HintManager in AbstractTab now, we need a ModeManager
present to use FakeWebTab.
2016-08-11 16:46:05 +02:00
Florian Bruhin
533319c1ae
tests: Use dict.update in mode_manager fixture
...
This means we can use the fixture in tests which use config_stub
themselves.
2016-08-11 16:45:00 +02:00
Florian Bruhin
ad5008152c
Move browser.webkit.history to browser.history
2016-08-10 14:45:52 +02:00
Florian Bruhin
c5a363c66c
tests: Add requested argument to FakeWebTab.url
2016-08-10 13:54:52 +02:00
Florian Bruhin
029ea2e5a7
Add miscwidgets.WrapperLayout.wrap
...
This makes it easier for an user of WrapperLayout to wrap a widget.
2016-08-04 19:22:44 +02:00
Ryan Roden-Corrent
ffc5a42d04
Don't use objreg to get CompletionView.
...
The CompletionView is the parent of the Completer, so there's no need
to use objreg to get it.
See #640 .
2016-07-28 12:20:24 -04:00
Ryan Roden-Corrent
a740f99607
Register the fake statusbar command in objreg.
...
The CompletionView looks in objreg for 'status-cmd', so move it from a
private fixture in test_completer to a public fixture that handles
objreg registration/deletion.
2016-07-28 12:20:24 -04:00
Ryan Roden-Corrent
aedf5b930a
Test Completer.schedule_completion_update.
...
update_completion is only used internally, so instead test the real
public entry point which is schedule_completion_update.
This required mocking out QTimer to fire immediately so the test didn't
have to do flaky artificial delays.
2016-07-28 12:20:24 -04:00
Florian Bruhin
d357ccf403
Add some more WebElementWrapper tests
2016-07-28 14:25:53 +02:00
Florian Bruhin
3ccb691e9f
tab API: Rename scroll to scroller
...
The scroll attribute did overwrite QWidget.scroll which is unfortunate.
2016-07-26 13:19:07 +02:00
Florian Bruhin
3ea6d4c527
Add KeyConfigStub.get_reverse_bindings_for
2016-07-26 12:06:42 +02:00
Florian Bruhin
a1c4e6e2cf
Rename shadowed tmpdir variable
2016-07-20 16:13:46 +02:00
Florian Bruhin
c7eec246d3
Merge branch 'cut_test_clutter' of https://github.com/rcorre/qutebrowser into rcorre-cut_test_clutter
2016-07-20 15:28:58 +02:00
Florian Bruhin
bf06f4a4d7
tests: Use dedicated logger for message mock
...
The message mock might handle a message during pytest-qt's processEvents
during test setup. If that happens, depending on the fixture order,
pytest-caplog might not be set up first, which is why the
self._caplog.at_level call can fail:
File "c:\projects\qutebrowser\qutebrowser\misc\guiprocess.py", line 105, in on_finished
immediately=True)
File "C:\projects\qutebrowser\tests\helpers\messagemock.py", line 71, in _handle_error
self._handle(Level.error, *args, **kwargs)
File "C:\projects\qutebrowser\tests\helpers\messagemock.py", line 65, in _handle
with self._caplog.at_level(log_level): # needed so we don't fail
File "C:\projects\qutebrowser\.tox\py34\lib\site-packages\pytest_catchlog.py", line 232, in at_level
obj = logger and logging.getLogger(logger) or self.handler
File "C:\projects\qutebrowser\.tox\py34\lib\site-packages\pytest_catchlog.py", line 186, in handler
return self._item.catch_log_handler
AttributeError: 'Function' object has no attribute 'catch_log_handler'
Full stack:
c:\projects\qutebrowser-git\.tox\py34\lib\site-packages\pytestqt\plugin.py(100)pytest_runtest_setup()
-> _process_events()
c:\projects\qutebrowser-git\.tox\py34\lib\site-packages\pytestqt\plugin.py(140)_process_events()
-> app.processEvents()
c:\projects\qutebrowser-git\qutebrowser\misc\guiprocess.py(94)on_error()
-> self._what, msg), immediately=True)
c:\projects\qutebrowser-git\tests\helpers\messagemock.py(71)_handle_error()
-> self._handle(Level.error, *args, **kwargs)
c:\projects\qutebrowser-git\tests\helpers\messagemock.py(65)_handle()
-> with self._caplog.at_level(log_level): # needed so we don't fail
c:\projects\qutebrowser-git\.tox\py34\lib\site-packages\pytest_catchlog.py(235)at_level()
-> obj = logger and logging.getLogger(logger) or self.handler
> c:\projects\qutebrowser-git\.tox\py34\lib\site-packages\pytest_catchlog.py(189)handler()->None
This should fix broken AppVeyor builds.
Fixes #1662 .
2016-07-20 14:23:09 +02:00
Ryan Roden-Corrent
7b3406a3e4
Use monkeypatch.setenv instead of os.putenv.
...
This ensures the environment is modified only for the test using the
fixture rather than for the whole test run.
2016-07-18 21:39:35 -04:00
Ryan Roden-Corrent
7d36847f77
Prevent test_tab from creating user data dir.
...
This is another case (like test_qt_javascript) that needs redirection
of XDG_DATA_HOME to prevent Qt from creating ~/.share/local/qute_test.
2016-07-17 07:07:05 -04:00
Ryan Roden-Corrent
a6695ea1be
Prevent test_adblock from creating real config dir.
...
Don't create ~/.config/qute_test by mocking out standdarddir.config for
all tests in this module.
This adds config_tmpdir to fixtures.py and moves temp_datadir from
test_adblock to fixtures.py as it will be needed more broadly.
2016-07-15 13:46:50 -04:00
Florian Bruhin
68f5ed4fa4
tests: Fix FakeWebTabScroller
...
Pass tab correctly
2016-07-13 13:47:26 +02:00
Florian Bruhin
f5359b67a2
tests: Fix default_config fixture
...
This wasn't used since the command tests were deactivated. It was broken
during some refactoring and nobody noticed.
2016-07-13 13:43:46 +02:00
Florian Bruhin
6a07d231f4
pykint: Add some disable=unused-variable
2016-07-11 13:18:31 +02:00
Florian Bruhin
86f381a3b7
Skip tests using fake_web_tab on PyQt < 5.6
...
For some weird reason they cause a segfault in QObject::disconnect since
fake_web_tab was converted to a fixture...
See #1638
2016-07-10 21:42:13 +02:00
Florian Bruhin
b791095324
Rename browser.tab module and classes
2016-07-10 17:27:02 +02:00
Florian Bruhin
2649418c0b
Fix lint
2016-07-10 17:04:26 +02:00
Florian Bruhin
fd8e66136f
tests: Add a mode_manager fixture
2016-07-10 17:04:25 +02:00
Florian Bruhin
52e14950f1
tests: Fix messagemock with stack argument
2016-07-10 17:04:25 +02:00
Florian Bruhin
2136d00aa2
tests: Add a fake_args fixture
2016-07-10 17:04:25 +02:00
Florian Bruhin
e36123735b
Use a fixture for FakeWebTab
...
We need to make sure qapp and tab_registry are available everywhere the
FakeWebTab class is used.
2016-07-10 16:57:02 +02:00
Florian Bruhin
782561462b
Use stubs.FakeWebTab to fake tabs
...
This also fixes the cur_url access.
2016-07-08 10:09:03 +02:00
Florian Bruhin
09f025628f
Use tab.AbstractTab for signals/slots
2016-07-07 18:32:52 +02:00
Florian Bruhin
17466b4f26
Fix some lint
2016-07-07 18:32:52 +02:00
Florian Bruhin
4e5a7a891e
tests: Use FakeWebTab for stubbing
2016-07-07 18:32:52 +02:00
Florian Bruhin
115021b8ea
Get QtWebEngine to start and work somewhat
2016-07-07 18:32:52 +02:00
Florian Bruhin
ebf9bc4e0a
Improve version output
2016-07-06 23:47:59 +02:00
Ryan Roden-Corrent
68e373df44
Use QLineEdit as a base for FakeStatusbarCommand.
...
Reduces the amount of mocking and keeps it more true to the original.
2016-07-03 23:06:36 -04:00
Ryan Roden-Corrent
7f690c3f3f
More unit test coverage for Completer.
...
Test completion_item{next,prev} and change_completed_part.
2016-07-03 22:58:09 -04:00
Ryan Roden-Corrent
13e8ed53d6
Clean up completer unit test.
...
Based on code review:
- import modules, not classes
- use methods, not lambdas for the mock command prompt class
- use None rather than Mock for DUMB_SORT
- autouse two fixtures and remove them from test signatures
2016-07-03 17:18:16 -04:00
Ryan Roden-Corrent
07edcce697
Unit test Completer.update_completion.
...
Validate update_completion sets the completions widget's model
correctly based on the command text.
2016-07-02 12:25:55 -04:00
Ryan Roden-Corrent
d45acb0388
Eliminate FakeSettingSection/Value.
...
Don't really need to mock these out for tests as the real classes are
simple enough.
2016-06-30 20:12:44 -04:00
Ryan Roden-Corrent
ee59b133c0
Don't bother mocking a history entry.
...
Use webkit.history.Entry in tests instead of FakeHistoryEntry.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
f50b8bb8e8
Use iter instead of __iter__.
...
Corrent two places this was used.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
d6012ad95c
Test delete_cur_item more cleanly.
...
Reduce duplicate code by mocking out a QTreeView around the model and
setting its index.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
9d49f5a57d
Test tab completion with multiple tabbed browsers.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
b6652ad6bc
Test completion quickmark/bookmark deletion.
...
Validate that quickmarks and bookmarks can be deleted from the url
completion menu.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
409de10fb4
Unit test delete_cur_item for tab completion model.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
8321c1a90f
Unit test setting value completion
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
f5b1019d4d
Unit test config option completion.
...
Had to add the `raw` parameter to ConfigStub.get as the setting option
completion model passes this argument explicitly (although the docs say
only raw=True is supported).
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
16f043034f
Unit test tab (buffer) completion.
...
This involved adding a few stubs as well as expanding the FakeWebView.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
610f9b7068
Unit test session completion
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
baf8d00a20
Unit test url/quickmark/bookmark completion.
...
This also adds a few more stubs/fakes to mock out the
quickmark-manager, bookmark-manager, and web-history objects.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
b037ec489f
Add unit tests for help completion.
...
Also adds a FakeConfigSection stub for stubbing out configdata.DATA.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
555bdb75b5
Add unit test for CommandCompletionModel.
...
This establishes a pattern that can probably be used to test any of the
completion models.
See #999 .
2016-06-30 07:26:02 -04:00
Florian Bruhin
4fccc89d7d
Split browser into browser/browser.webkit
2016-06-13 11:18:21 +02:00
Daryl Finlay
054e9ab439
Add host placeholder to window and tab title formats
2016-06-10 21:59:43 +01:00
Florian Bruhin
33f01d8375
Fix lint
2016-06-09 21:14:03 +02:00
Florian Bruhin
789b9c9308
tests: Yield fake_save_manager from fixture
2016-06-09 17:44:04 +02:00
Florian Bruhin
75669dd21b
tests: Move fake_save_manager to helper.fixtures
2016-06-09 17:44:04 +02:00
Florian Bruhin
ef2b3cd6d9
tests.helpers: Clean up imports
2016-06-09 17:44:04 +02:00
Florian Bruhin
483a5f8103
Fix sharing of cookie jars with private browsing
...
Fixes #1219
2016-06-08 16:35:43 +02:00
Florian Bruhin
520572321a
Add unittests for partial command parsing
2016-06-06 16:18:49 +02:00
Florian Bruhin
10630e30ab
hints: Integrate _get_first_rectangle into webelem
2016-06-06 11:56:15 +02:00
Florian Bruhin
64d4c9f83e
Clean up end2end test file structure
...
This renames tests/integration to tests/end2end and moves some files to
tests/end2end/fixtures.
2016-05-29 18:20:00 +02:00
Ryan Roden-Corrent
581a521b4d
Allow setting mock keybindings for unit tests.
...
Implement mock_key_config.set_bindings_for to set bindings that will be
retrieved by mock_key_config.get_bindings_for.
This is useful for testing the new keyhint ui.
2016-05-15 22:18:16 -04:00
Florian Bruhin
2a343cb3a1
Various code style improvements
2016-04-27 20:25:27 +02:00
Florian Bruhin
e53c136342
tests: Refactor partial_compare
...
Functions now return a PartialCompareOutcome to attach an error message instead
of a bool, and the main function got rewritten based on a handler dict.
2016-04-21 00:14:13 +02:00
Florian Bruhin
5a5e8167dd
Fix lint
2016-03-29 23:20:39 +02:00
Florian Bruhin
4067d38cb0
Add some tests for QtWebKit/Engine JS capabilities
2016-03-29 22:08:49 +02:00
Philipp Hansch
e0e8bc805b
Remove unneeded argument
...
Instead, figure out the data directory from the helpers directory.
2016-03-29 19:52:46 +02:00
Philipp Hansch
e9ae2156d3
Comply with flake8
2016-03-29 00:08:14 +02:00
Philipp Hansch
5811a25299
Add a datapath replacement for spawning userscripts
...
This adds a `(datapath)` replacement for feature tests.
`(datapath)` will expand to the absolute path to the integration data
directory.
2016-03-28 23:48:37 +02:00
Florian Bruhin
83dc390808
tests: Move fixtures into a separate file.
2016-02-04 07:27:23 +01:00
Florian Bruhin
526441bcae
Fix new flake8 lint.
...
For some reason these issues weren't shown with pytest-pep8/flakes.
2016-01-22 17:33:58 +01:00
Florian Bruhin
a5f2ac5f03
Adjust copyright years.
2016-01-04 07:12:39 +01:00
Florian Bruhin
59c8e5c3d1
Add some tests for commands.userscripts.
2015-12-21 08:45:46 +01:00
Florian Bruhin
b3515f5e82
pylint: Remove import-error disabling from tests.
2015-12-01 22:47:10 +01:00
Florian Bruhin
5817b47f75
Revert "Use fully qualified imports in tests."
...
Seems like this also breaks frozen tests...
This reverts commit c7fdcc92b8
.
2015-12-01 22:45:59 +01:00
Florian Bruhin
c7fdcc92b8
Use fully qualified imports in tests.
...
This is cleaner even if pylint can't handle it.
2015-12-01 22:03:59 +01:00
Florian Bruhin
788a096150
pylint: Ignore import-error globally for tests.
2015-12-01 22:03:59 +01:00
Florian Bruhin
150a83d8f4
pylint: Remove unneeded supressions.
2015-12-01 22:03:58 +01:00
Florian Bruhin
3290048458
tests: Do custom fnmatch-like matching.
...
fnmatch treats [, ] and ? as shell metacharacters too, and has no way to escape
them. We need a literal [] and really only need * for filtering.
2015-11-13 07:56:59 +01:00
Florian Bruhin
9c5ce8a688
tests: Improve partial_compare output.
2015-11-12 19:04:37 +01:00
Florian Bruhin
416cfaf002
tests: Switch from pytest-capturelog to catchlog.
2015-11-11 19:57:03 +01:00
Florian Bruhin
6e7d6fb00e
tests: Use fnmatch for strings in partial_match.
2015-11-10 06:50:31 +01:00
Florian Bruhin
e13de98790
Fix lint.
2015-11-02 23:49:44 +01:00
Florian Bruhin
3155e20999
tests: Add helpers to compare sessions.
2015-11-02 23:41:48 +01:00
Daniel
0851999b89
Add unit/regression test
2015-10-23 19:52:56 +02:00
Florian Bruhin
d5baed5e83
Merge branch 'cookies_tests' of https://github.com/acogneau/qutebrowser into acogneau-cookies_tests
2015-09-16 22:58:28 +02:00
Florian Bruhin
b0c2021eca
Revert "logfail: Update tests to use testdir."
...
This reverts commit f7e40f73ab
.
Conflicts:
tests/helpers/test_logfail.py
2015-09-09 08:49:51 +02:00
Florian Bruhin
2f8b39df1c
Revert "logfail: Switch tests to subprocess pytest runs."
...
This reverts commit 09c265ddb0
.
2015-09-09 08:49:17 +02:00
Florian Bruhin
f7c405d2f4
Revert "logfail: Continue running test and fail afterwards."
...
This reverts commit 66ed4e9c4e
.
2015-09-09 08:49:06 +02:00
Florian Bruhin
909cafb516
Fix lint.
2015-09-09 07:58:14 +02:00
Florian Bruhin
66ed4e9c4e
logfail: Continue running test and fail afterwards.
2015-09-09 07:58:14 +02:00
Florian Bruhin
09c265ddb0
logfail: Switch tests to subprocess pytest runs.
...
It seems they're much more reliable this way.
2015-09-09 07:58:14 +02:00
Florian Bruhin
f7e40f73ab
logfail: Update tests to use testdir.
...
This makes more sophisticated tests easier.
2015-09-09 07:58:14 +02:00
Florian Bruhin
f5d9e967ef
logfail: Rename capturelog module.
...
When trying to use this as conftest for the updated tests, pytest_* would be
interpreted as hook otherwise.
2015-09-09 07:58:14 +02:00
Alexander Cogneau
418328e61b
Cookie tests done
2015-09-03 18:17:39 +02:00
Alexander Cogneau
96e3a0b1f1
first cookie tests
2015-09-03 17:24:01 +02:00
Florian Bruhin
18af0b4b35
tests: Make FakeSignal callable.
2015-09-02 23:32:06 +02:00
Florian Bruhin
8ea91b5bbc
Fix cookiejar_and_cache move.
2015-08-31 08:00:21 +02:00
Florian Bruhin
6df00f8266
Move cookiejar_and_cache fixture to conftest.py.
2015-08-30 23:11:23 +02:00
Florian Bruhin
7bc5996d52
tests: Provide activeWindow() in FakeQApplication.
2015-08-23 21:55:25 +02:00
Florian Bruhin
b11e075047
Add __getitem__ to ConfigStub.
2015-08-19 20:39:48 +02:00
Florian Bruhin
1ddd65304a
tests: Use a real signal for ConfigStub.
2015-08-19 19:37:19 +02:00
Florian Bruhin
086c6c81a1
Simplify message_mock usage and assert more things.
2015-08-19 09:44:31 +02:00
Florian Bruhin
e4a0f1972f
tests: Improve MessageMock and use it.
2015-08-18 21:38:18 +02:00
Florian Bruhin
6d1b0ba260
Clean up conftest.py.
2015-08-18 20:43:42 +02:00
Florian Bruhin
2c5269acd6
Reorganize tests directory.
2015-08-18 20:19:02 +02:00