Commit Graph

300 Commits

Author SHA1 Message Date
Florian Bruhin
6c4beef783 Work around flake8-string-format bug
When using flake8-string-format on Python 3.5 with str.format(*group) it
failed:

  Traceback (most recent call last):
    File "./.venv-flakes/bin/flake8", line 11, in <module>
      sys.exit(main())
    File ".../site-packages/flake8/main.py", line 33, in main
      report = flake8_style.check_files()
    File ".../site-packages/flake8/engine.py", line 181, in check_files
      return self._retry_serial(self._styleguide.check_files, paths=paths)
    File ".../site-packages/flake8/engine.py", line 172, in _retry_serial
      return func(*args, **kwargs)
    File ".../site-packages/pep8.py", line 1842, in check_files
      runner(path)
    File ".../site-packages/flake8/engine.py", line 126, in input_file
      return fchecker.check_all(expected=expected, line_offset=line_offset)
    File ".../site-packages/pep8.py", line 1574, in check_all
      self.check_ast()
    File ".../site-packages/pep8.py", line 1521, in check_ast
      for lineno, offset, text, check in checker.run():
    File ".../site-packages/flake8_string_format.py", line 288, in run
      assert isinstance(call.args, ast.Starred) is bool(has_starargs)
  AssertionError

This works around that issue.
See https://github.com/xZise/flake8-string-format/issues/11
2016-05-26 23:50:58 +02:00
Ryan Roden-Corrent
f58e2d91dc Add a keyhint blacklist.
Replace the setting ui.show-keyhints with ui.keyhint-blacklist, which
is a list of globs for keychains that shouldn't be hinted. This allows
users to prevent showing keyhints for keychains they already know.

keyhint-blacklist='*' is equivalent to show-keyhints=False.

Resolves #1515.
2016-05-24 20:46:39 -04:00
Ryan Roden-Corrent
b1aaf0f10f Only show keyhints after a short delay.
If a user knows the keychain and can type it quickly, we shouldn't
annoy them with a popup. Only show the keyhint if the user doesn't
complete their keychain in 500ms.

The isVisible() check in the tests is somewhat invalid now because it
is never immediately visible and I don't want to add a delay to unit
tests. I added a check that text() is not set for one test that was
only checking isVisible().

Addresses part of #1515.
2016-05-23 21:21:03 -04:00
Florian Bruhin
b934f8bc4e Fix lint 2016-05-20 13:07:36 +02:00
Ryan Roden-Corrent
5992b81850 Don't show keyhint if there are no hints.
Currently, the keyhint window is shown even if the keystring matches no
possible bindings. This causes an empty keyhint window to hang around
after entering hinting mode.

Instead, the window is now hidden if no bindings match the current
keystring.

Resolves #1507.
2016-05-19 07:02:23 -04:00
Ryan Roden-Corrent
822d148713 Update key hint tests for new format.
Change the unit tests to expect the new tabular format.
Also generally clean up the tests -- refactor from a class to
module-level functions as there was no need for a class here.
2016-05-17 07:04:53 -04:00
Ryan Roden-Corrent
3cd252ef82 Clean up html for keyhint text.
The \t was behaving the same as a space and the <b> was doing nothing.
2016-05-15 22:33:53 -04:00
Ryan Roden-Corrent
8eee5def5d Add unit tests for the keyhint widget.
- validate keyhint text for a partial keychain
- ensure special keybindings are not suggested
- ensure it is not visible when disabled
- ensure changes to the suffix color are picked up
2016-05-15 22:20:52 -04:00
Florian Bruhin
2a343cb3a1 Various code style improvements 2016-04-27 20:25:27 +02:00
Florian Bruhin
1954ebd63c Fix test_last_window_session_none 2016-04-10 18:22:58 +02:00
Florian Bruhin
642dc46ba9 flake8: Add hacking 2016-04-08 07:35:53 +02:00
Florian Bruhin
2f520f3b17 Rename test_editor.py to test_editor_unit.py 2016-04-05 19:49:01 +02:00
Florian Bruhin
19edea7343 Rename unit/misc/test_sessions.py to *_unit.py
Otherwise we get:

import file mismatch:
imported module 'test_sessions' has this __file__ attribute:
  /home/florian/proj/qutebrowser/git/tests/integration/features/test_sessions.py
which is not the same as the test file we want to collect:
  /home/florian/proj/qutebrowser/git/tests/unit/misc/test_sessions.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
2016-04-01 07:52:54 +02:00
Florian Bruhin
74706abbc1 Fix lint 2016-03-17 22:10:58 +01:00
Florian Bruhin
0830b400fe Merge branch 'editor_crash_behaviour' of https://github.com/EliteTK/qutebrowser into EliteTK-editor_crash_behaviour 2016-03-17 21:40:17 +01:00
Florian Bruhin
5311576c34 Check pep257 via flake8.
We'll still keep the pydocstyle environment though until flake8-pep257 adds
support for that:

https://github.com/Robpol86/flake8-pep257/issues/6
2016-02-10 19:18:47 +01:00
Florian Bruhin
7f791dfcb8 Remove now obsolete test. 2016-02-10 07:06:34 +01:00
Florian Bruhin
37bb26bdd5 Add a test in test_editor.py. 2016-02-02 06:53:12 +01:00
Oliver Caldwell
54ff2aa46c Merge remote-tracking branch 'TheCompiler/master' into relax-editor-templating 2016-01-31 22:43:58 +00:00
Oliver Caldwell
84c44f3395 Remove invalid test parameter 2016-01-31 22:23:35 +00:00
Florian Bruhin
4d9ea06768 tests: Make test IDs predictable.
This means we could use xdist in the future.
2016-01-25 22:15:31 +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
ff2024a565 Add socket IDs to ipc debug messages. 2016-01-08 12:02:36 +01:00
Florian Bruhin
9ed79ad57d tests: Switch to qtbot.assertNotEmitted. 2016-01-08 10:00:42 +01:00
Florian Bruhin
1fb34331e5 tests: Default to raising=True for qtbot.
- qtbot.waitSignal with raising=True is the default this way, so we remove the
  raising=True.
- qtbot.waitSignal with raising=False stay untouched
- Some qtbot.waitSignal without raising had one added (because we don't want it
  to raise)
- Some qtbot.waitSignal without raising actually should've raised, which they
  do now.
2016-01-08 09:49:06 +01:00
Florian Bruhin
a5f2ac5f03 Adjust copyright years. 2016-01-04 07:12:39 +01:00
Florian Bruhin
168f65b1a4 tests: Use caplog.at_level, not atLevel. 2015-12-21 09:52:33 +01:00
Florian Bruhin
9f64dfb3b6 Skip all tests using py_proc when frozen. 2015-12-21 09:46:30 +01:00
Florian Bruhin
fc3a3ea8c6 Add missing not_frozen mark in test_guiprocess.
This should fix test failures when frozen.
2015-12-20 18:40:57 +01:00
Florian Bruhin
5c769d8000 Report stdout/stderr of failed subprocesses. 2015-12-18 21:23:33 +01:00
Florian Bruhin
c1951a8f15 tests: Get rid of QSignalSpy where we can. 2015-12-17 07:49:28 +01:00
Florian Bruhin
e6284ed5d4 tests: Improve some ugly test IDs. 2015-12-16 22:21:29 +01:00
Florian Bruhin
eff0e4c7cc pylint: Enable useless-suppression globally.
We deactivate it locally where needed, i.e. where we are sure it's some
platform-specific thing.
2015-12-01 23:01:09 +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
109984c96e pylint: Check attr-defined-outside-init for tests. 2015-12-01 22:41:16 +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
150a83d8f4 pylint: Remove unneeded supressions. 2015-12-01 22:03:58 +01:00
Tomasz Kramkowski
c575435782 misc/editor: Fix tempfile deleted on error / editor crash
This patch attempts to fix an issue where an error occuring in
misc/guiprocess or the editor process crashing would delete the
temporary file thus making it impossible to recover changes not commited
to the form field from the editor.
2015-12-01 20:22:05 +00:00
Florian Bruhin
f7a13fa1f9 Rename LineParserWrapper to LineParserMixin.
This makes pylint shut up as it realizes it is, in fact, a mixin.
2015-11-30 07:11:35 +01:00
Florian Bruhin
83b94a8be5 Fix session tests.
FakeMainWindow needs to be a QObject now as we use sip.isdeleted since
8cf6ace0e7 and that raises a TypeError on
non-QObject's.
2015-11-28 20:41:42 +01:00
Florian Bruhin
be4cf19bb1 tests: Improve some parametrized test IDs. 2015-11-27 16:25:25 +01:00
Florian Bruhin
f3c378858b tests: Remove duplicate test_split testcases. 2015-11-27 16:22:48 +01:00
Florian Bruhin
196d1e95be tests: Skip test_normal_connection IPC test on OS X.
Seems like it hangs there sometimes.
2015-11-23 20:33:11 +01:00
Florian Bruhin
40c7990d3a tests: Skip ipc TestSendToRunningInstance on OS X.
This did hang often on OS X, and I don't have the time to properly debug this.

See #1045.
2015-11-12 22:17:37 +01:00
Florian Bruhin
416cfaf002 tests: Switch from pytest-capturelog to catchlog. 2015-11-11 19:57:03 +01:00
Florian Bruhin
0d67cff5cb Merge branch 'bdd'
Conflicts:
      tests/test_conftest.py
      tox.ini
2015-11-02 06:36:30 +01:00
Florian Bruhin
4451165a27 Change IPC warnings to debug.
This seems to show up on Ubuntu Trusty (with older Qt) as well...
2015-11-01 23:11:42 +01:00
Florian Bruhin
867f509bcc tests: Ignore QDisabledNetworkReply warning.
I guess they are displayed now during teardown with the changes in pytest-qt.
2015-11-01 18:04:09 +01:00
Florian Bruhin
c85aa40073 Skip connected_socket IPC tests on OS X.
Fixes #1045 - I don't have the time to look into this :-/
2015-10-26 09:04:41 +01:00
Florian Bruhin
24dc166e1f tests: Use extend=True for qt_log_ignore marks.
This should finally resolve the warning flakiness on OS X.
2015-10-16 06:24:29 +02:00
John ShaggyTwoDope Jenkins
65418307fd typos 2015-10-13 16:09:49 -07:00
Florian Bruhin
129df05932 ipc: Skip socketOptions test on Qt < 5.4. 2015-10-07 22:04:30 +02:00
Florian Bruhin
7db1f65425 ipc: Avoid using QLocalServer.setSocketOptions.
This causes problems with AddressInUseError being swallowed.

Fixes #997.
2015-10-07 21:52:09 +02:00
Jonas Schürmann
afc166a13e Coding style fixes #1002 2015-10-06 22:59:49 +02:00
Jonas Schürmann
45c9768c16 Added --target command line argument #922
This argument is used to override the new-instance-open-target config
option.
2015-10-05 21:15:52 +02:00
Florian Bruhin
f4fdcbdd71 Add a --check-all to check_coverage.py. 2015-10-04 20:35:24 +02:00
Florian Bruhin
d229e90724 Fix some splelling mistakes. 2015-10-04 15:41:42 +02:00
Florian Bruhin
240e271b0d tests: Translate platform markers to skipif marks.
This means pytest shows the correct location and the marks work correctly when
marking individual items in a parametrize marker.
2015-10-02 09:26:33 +02:00
Florian Bruhin
18bd20e109 Skip test_ipc:test_timeout on OS X.
It almost always causes issues and I have no idea why... Let's skip it for now.

Fixes #975.
2015-10-02 08:52:51 +02:00
Florian Bruhin
9f7836131d tests: Add a reason argument to platform markers. 2015-10-02 08:51:22 +02:00
Alexey Nabrodov
293c9f1022 trying to fix tests 2 2015-10-01 16:34:34 +03:00
Alexey Nabrodov
044c0a0c4f trying to fix tests 2015-10-01 16:26:56 +03:00
Alexey Nabrodov
54d4f4f48b refactor and test 2015-10-01 15:57:11 +03:00
Florian Bruhin
4854ca42fd Fix tests without DISPLAY. 2015-09-28 21:50:55 +02:00
Florian Bruhin
a4569b11ad tests: Skip test_stale_legacy_server when frozen. 2015-09-17 22:02:12 +02:00
Florian Bruhin
fbf9c74752 tests: Increase some timeouts for OS X. 2015-09-17 21:22:35 +02:00
Florian Bruhin
7e84a1a5b8 Fix lint. 2015-09-17 20:02:39 +02:00
Florian Bruhin
0f69487f22 Adjust pylint ignores for py.path.
Since db513aa pylint can now import py, but fails because it can't infer that
there's a py.path.
2015-09-17 19:12:28 +02:00
Florian Bruhin
1a1862a10d Increase timeout. 2015-09-16 20:26:31 +02:00
Florian Bruhin
0fa9da56bf Revert "ipc tests: Speed up TestListen::test_atime_update."
This reverts commit 443a2e1657.

We actually need to wait a bit to make sure the atime is updated.
2015-09-16 07:16:14 +02:00
Florian Bruhin
443a2e1657 ipc tests: Speed up TestListen::test_atime_update. 2015-09-16 07:13:31 +02:00
Florian Bruhin
7ffff72368 ipc: Make sure server is always shut down in tests.
Hopefully fixes #947.
2015-09-16 07:11:30 +02:00
Florian Bruhin
dd2a70e01f Fix IPC tests.
This was broken when adding some more logging.
2015-09-16 07:10:54 +02:00
Florian Bruhin
b06578a816 Fix lint. 2015-09-11 08:39:42 +02:00
Florian Bruhin
9ca001e71c Fix lint. 2015-09-11 08:32:45 +02:00
Florian Bruhin
c77956c9c5 Fix GUIProcess tests.
The logging checks were of little use and some tests were basically duplicated.
2015-09-11 08:32:16 +02:00
Florian Bruhin
28c8e4acbf Unskip GUIProcess tests on Windows. 2015-09-11 07:37:54 +02:00
Florian Bruhin
b126030f62 Revert "ipc: Skip problematic test on Ubuntu Trusty."
This reverts commit 729be7e7cc.
2015-09-11 07:37:13 +02:00
Florian Bruhin
d15cc07ed3 Log executed command for GUIProcess.
See #797.
2015-09-11 06:24:05 +02:00
Florian Bruhin
729be7e7cc ipc: Skip problematic test on Ubuntu Trusty. 2015-09-10 08:21:37 +02:00
Florian Bruhin
87ccc31cce ipc: Add some more tests for _atime_timer. 2015-09-10 08:02:19 +02:00
Florian Bruhin
58073fd768 ipc: Update the atime of the socket all 6h.
See #888.
2015-09-10 07:38:11 +02:00
Florian Bruhin
f7d3070c34 ipc: Fix start when a stale legacy server exists. 2015-09-09 19:39:01 +02:00
Florian Bruhin
37a2523bff Add a py_proc fixture to conftest.py. 2015-09-09 19:39:01 +02:00
Florian Bruhin
1d7c2b6b82 Don't set TMPDIR for test_legacy.
This has no real benefit and seems to break tests with some platforms.
2015-09-09 19:31:52 +02:00
Florian Bruhin
011b571336 Use a shorter tempdir. 2015-09-09 19:31:52 +02:00
Florian Bruhin
b135569d5c ipc: Add workaround for NameError w/ SocketOptions. 2015-09-09 19:31:52 +02:00
Florian Bruhin
69e735c42e ipc: Add username to hash instead. 2015-09-09 19:31:52 +02:00
Florian Bruhin
34bd000442 Use shorter names.
The typical test path for a legacy FIFO was something like:

    /tmp/pytest-92/test_correct_socket_name0/qutebrowser_test/qutebrowser-ipc-dfc627b5be8602ea0e9cd258b73c0bc3

This is probably too long for a Unix local domain socket (104 chars max).
2015-09-09 19:31:52 +02:00
Florian Bruhin
4daa7e6979 Don't add username to FIFO name on Linux.
The runtime directory already has a qutebrowser subdir.
2015-09-09 19:31:52 +02:00
Florian Bruhin
3573b57130 Set socket permissions correctly. 2015-09-09 19:31:52 +02:00
Florian Bruhin
78cb0eaf85 More work on #888 (new IPC path).
First trying the legacy path and then using the new one works fine now, but the
permissions are still wrong.
2015-09-09 19:31:52 +02:00
Florian Bruhin
a4bc4ad478 Only log a single message in utils.error.
This helps with seeing the full message with logfail.
2015-09-09 19:31:52 +02:00
Florian Bruhin
6a0994038e Start working on #888 (new IPC path). 2015-09-06 19:50:22 +02:00
Florian Bruhin
bfd8faafef Add a protocol version to IPC.
Fixes #909.
2015-09-06 18:43:24 +02:00
Florian Bruhin
b95fd2c814 Test raw json data for IPC. 2015-09-06 18:06:23 +02:00
Florian Bruhin
bf9a897ce8 Skip some more IPC tests on Windows. 2015-09-06 16:42:44 +02:00
Florian Bruhin
9521da3c73 Fix error output with --no-err-windows. 2015-09-04 08:04:18 +02:00
Florian Bruhin
ea0cbea1dd ipc: Use a custom class for exceptions. 2015-09-04 07:12:23 +02:00
Florian Bruhin
2a4cd02704 100% coverage for misc.ipc. 2015-09-04 06:58:46 +02:00
Florian Bruhin
f77bdb7aec Adjust test_ipcserver_socket_none for prev commit. 2015-09-03 23:38:33 +02:00
Florian Bruhin
b40fb4dd43 ipc: Handle None-socket in slots correctly. 2015-09-03 20:48:51 +02:00
Florian Bruhin
27ee09a7a1 ipc: Skip test_normal on Windows. 2015-09-03 14:35:27 +02:00
Florian Bruhin
2f92ea92d8 test_ipc: Remove disconnect assert. 2015-09-03 11:55:21 +02:00
Florian Bruhin
f682477960 Fix some more IPC tests on Windows. 2015-09-03 11:55:17 +02:00
Florian Bruhin
46b28387db Rewrite test_double_connection.
This caused various problems in the old form.
2015-09-03 06:38:35 +02:00
Florian Bruhin
efe40fa7e0 Try different workaround for test_ipc issues. 2015-09-03 06:12:36 +02:00
Florian Bruhin
154c380fd0 Fix pylint in test_ipc. 2015-09-02 23:32:06 +02:00
Florian Bruhin
d966720900 ipc tests: More tests. 2015-09-02 23:32:06 +02:00
Florian Bruhin
b4c90c5db4 ipc tests: Clean up qlocalsocket correctly.
If we don't do this, on_error will be invoked with old sockets, when
self._socket is None...
2015-09-02 23:32:06 +02:00
Florian Bruhin
6468e60a36 ipc tests: Fix waiting for FakeSocket. 2015-09-02 23:32:06 +02:00
Florian Bruhin
a63f0d5409 More IPC tests. 2015-09-02 23:32:06 +02:00
Florian Bruhin
38ebd806cc Add some tests for misc.ipc. 2015-09-02 23:32:06 +02:00
Florian Bruhin
0c3ee46fe0 Merge branch 'autoupdate_tests' of https://github.com/acogneau/qutebrowser into acogneau-autoupdate_tests 2015-09-01 08:48:52 +02:00
Alexander Cogneau
2d12c26e8c Add extra url assertion for autoupdate 2015-09-01 01:06:11 +02:00
Alexander Cogneau
8ab85d6246 small edits to autoupdate test 2015-08-31 09:30:16 +02:00
Alexander Cogneau
ee77951e66 PEP8 fixes 2015-08-31 01:25:42 +02:00
Alexander Cogneau
e499d8932f 100% misc.autoupdate coverage 2015-08-31 01:10:04 +02:00
Florian Bruhin
ed9a29fb9a test_cmdhistory: Remove patching for prev/nextitem. 2015-08-27 06:40:14 +02:00
Florian Bruhin
3fac246744 test_cmdhistory: Add test for __getitem__. 2015-08-27 06:38:41 +02:00
Florian Bruhin
4a48ef2573 Add my copyright. 2015-08-27 06:30:54 +02:00
Florian Bruhin
38c5abfc98 Remove unneeded self-parameter. 2015-08-27 06:30:12 +02:00
Florian Bruhin
66700e9a94 Remove exception string checks. 2015-08-27 06:28:26 +02:00
Florian Bruhin
4544c78395 Remove unneeded comments/monkeypatching. 2015-08-27 06:25:10 +02:00
Florian Bruhin
4fb3114af8 Merge branch 'cmdhistory_tests' of git://github.com/acogneau/qutebrowser into acogneau-cmdhistory_tests 2015-08-27 06:18:30 +02:00
Florian Bruhin
3e255eae64 Skip some tests when frozen. 2015-08-26 20:29:56 +02:00
Alexander Cogneau
fd6e0559a6 remove unnecessary function 2015-08-26 12:10:25 +02:00
Alexander Cogneau
3a4069667a Remove test functions out of class 2015-08-26 12:07:47 +02:00
Florian Bruhin
8ffe591f98 Skip TestSave.test_long_output on Windows.
This seems to segfault unpredictably when exiting pytest and I can't find out
why.

Fixes #895.
2015-08-26 10:06:49 +02:00
Alexander Cogneau
9ef9224c32 Remove unecessary class 2015-08-26 00:20:14 +02:00
Alexander Cogneau
a1dff7d535 Final cmdhistory tests 2015-08-26 00:16:18 +02:00
Alexander Cogneau
18d42d1f0a More tests for cmdhistory 2015-08-25 22:17:42 +02:00
Florian Bruhin
11f4fbc772 Silence pylint. 2015-08-25 21:24:58 +02:00
Alexander Cogneau
26058f4e80 A few cmdhistory tests 2015-08-25 18:46:49 +02:00
Florian Bruhin
987b39885a sessions: Add more tests. 2015-08-25 17:49:45 +02:00
Florian Bruhin
a8d549cb24 sessions: Add some more tests. 2015-08-24 17:12:20 +02:00
Florian Bruhin
f79e2c92a4 Read back session test data as UTF-8. 2015-08-24 08:44:41 +02:00
Florian Bruhin
9d601e8eb9 Fix session tests. 2015-08-24 08:31:11 +02:00
Florian Bruhin
e7a52a0833 Add some tests for misc.sessions. 2015-08-24 08:00:32 +02:00
Florian Bruhin
3d4fd2652b test_editor: Skip un{read,writ}able on Windows.
Windows doesn't really have working file permissions...
2015-08-19 10:18:55 +02:00
Florian Bruhin
086c6c81a1 Simplify message_mock usage and assert more things. 2015-08-19 09:44:31 +02:00
Florian Bruhin
685bbaae6d 100% test coverage for misc.editor. 2015-08-19 09:34:44 +02:00
Florian Bruhin
aa367fa004 Simplify test_editor. 2015-08-19 09:09:09 +02:00
Florian Bruhin
acfdf8b956 Fix lint. 2015-08-19 07:57:47 +02:00
Florian Bruhin
aca082ce83 100% test coverage for misc.guiprocess. 2015-08-19 07:57:02 +02:00
Florian Bruhin
4efa022528 Fix test_checkpyver on Pythons without Tkinter. 2015-08-19 07:12:04 +02:00
Florian Bruhin
1a61e53daa 100% test coverage for misc.checkpyver. 2015-08-19 05:58:52 +02:00
Florian Bruhin
e4a0f1972f tests: Improve MessageMock and use it. 2015-08-18 21:38:18 +02:00
Florian Bruhin
2c5269acd6 Reorganize tests directory. 2015-08-18 20:19:02 +02:00