Commit Graph

1617 Commits

Author SHA1 Message Date
Florian Bruhin
1d87eee4d7 Fix starting when sys.stderr is None 2016-05-27 14:48:46 +02:00
Florian Bruhin
afcb018ee2 Fix some spelling mistakes
Found via http://jwilk.net/software/mwic
2016-05-27 12:07:00 +02:00
Florian Bruhin
2fb5de8bd3 test_insert_mode: Always set fake clipboard
Otherwise if we only run a keypress test, the fake clipboard won't be
activated and thus the subsequent :yank-selected would write to the real
clipboard.
2016-05-27 00:12:53 +02:00
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
Tarcisio Fedrizzi
a3e6761db6 Fixes pylint error 2016-05-26 18:01:01 +02:00
Tarcisio Fedrizzi
a9e96df5df Adds unit test when force_search is True 2016-05-26 18:01:01 +02:00
Tarcisio Fedrizzi
462f9d7e4c Refators discussed in the review
- refactors what discussed in the review
- adds unit tests for schemas without host and path
2016-05-26 18:01:01 +02:00
Ryan Roden-Corrent
db09cbb960 Implement a feature test for :hint all userscript.
This adds a (testdata) substitution for 'When I run {command}' to allow
providing an absolute path for the userscript.
2016-05-26 07:35:28 -04:00
Nick Ginther
1ea99c5958 add completing single option argument test 2016-05-25 17:52:36 -05:00
Florian Bruhin
c96722f169 Merge branch 'better_keyhints' of https://github.com/rcorre/qutebrowser into rcorre-better_keyhints 2016-05-25 22:04:51 +02:00
Tarcisio Fedrizzi
73c200fb14 Tweaks the multi-line heuristic to handle scheme-like text
Adds some options to implement a way to treat multiline text that starts
with a scheme-like line as text instead as an URL.
2016-05-25 08:05:57 +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
Florian Bruhin
f100eb6e03 Mark iframe hint tests as xfail_norun as a stopgap
See #1525.
2016-05-24 22:23:42 +02:00
Florian Bruhin
3bbc950616 Fix lint 2016-05-24 21:53:50 +02:00
Florian Bruhin
846fe8b943 Add a test for #1484 2016-05-24 21:36:09 +02: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
Jakub Klinkovský
ee8247525e simplify testcase for following a hint inside an iframe 2016-05-22 15:19:00 +02:00
Ryan Roden-Corrent
648f89ef31 Implement more tests for the hinting.
Validate the hint spawn fix as well as add feature tests for previously
untested hinting behaviors (fill, run, --rapid).

There is still no test for the 'userscript' target as running a
userscript from hint mode during a test does not get the same
redirection as the 'I execute the userscript ...' statement, That is,
it looks in /usr/local/share/qutebrowser/userscripts rather than
tests/integration/data/userscripts.
2016-05-21 07:48:52 -04:00
Ryan Roden-Corrent
87cb5bf6c2 Fix test html link for hints 2016-05-20 22:13:49 -04:00
Ryan Roden-Corrent
f025394e04 Set maxsplit=2 for :hint.
This supports things like :hint all spawn -v echo as '-v echo' will be
passed as a single unit to spawn rather than -v being interpreted as a
flag for :hint.

Resolves #797.

Note that, while `:hint --rapid all spawn -v` echo works,
`:hint all --rapid spawn -v echo` does not (this did not work before
either).
2016-05-20 22:11:58 -04:00
Ryan Roden-Corrent
0300f03ebc Allow passing args to spawn from :hint.
Instead of creating a new guiprocess manually, just pass the args along
to the spawn command so it can accept args like -v.

Addresses part of #797 by allowing `hint -- all spawn -v echo`.
`hint all spawn -v echo` is still not supported.
2016-05-20 22:11:58 -04:00
Florian Bruhin
a5c08e23b6 Fix path to link.html in new tests 2016-05-20 17:21:05 +02:00
Florian Bruhin
ea1f46d542 Merge branch 'hints_clicking' of https://github.com/lahwaacz/qutebrowser into lahwaacz-hints_clicking 2016-05-20 17:09:16 +02:00
Florian Bruhin
107934e4e1 bdd: Wait a bit in "No crash should happen" step
If we don't do this, the qutebrowser process will be terminated and exit
before it actually has a chance to crash.

See #1510
2016-05-20 16:03:52 +02:00
Florian Bruhin
b934f8bc4e Fix lint 2016-05-20 13:07:36 +02:00
Ryan Roden-Corrent
b1440a1804 Implement utils.is_special_key.
The check `key.startswith('<') and key.endswith('>') is repeated many
times in code to check for a special key. Replace all these with a call
to the same function.
2016-05-19 20:48:48 -04: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
Stefan Tatschner
2c7dc6ffcc Add invalid url to 'test_set_hover_url_encoded'
This covers the recently introduced code path, in 1c23815 (Fix crash
when hovering over an invalid URL, 2016-05-18) when hovering an
invalid URL.
2016-05-18 22:23:26 +02:00
Florian Bruhin
d0af80fbd5 Merge branch 'keystring' of https://github.com/rcorre/qutebrowser into rcorre-keystring 2016-05-18 07:33:17 +02:00
Florian Bruhin
324fcfadb0 Merge branch 'hint_inputs' of https://github.com/Liambeguin/qutebrowser into Liambeguin-hint_inputs 2016-05-18 07:30:46 +02:00
Florian Bruhin
02cbc2f986 Merge branch 'pretty-hover-url' of https://github.com/forkbong/qutebrowser into forkbong-pretty-hover-url 2016-05-18 07:27:30 +02:00
Florian Bruhin
e4d84b0bfc Simplify argparser.type_check
If the value isn't param.default, it will always be a string or a flag, as
type_conv never gets called when the function is called from Python.
2016-05-18 07:16:17 +02:00
Florian Bruhin
a83bf9c3ee Simplify argparser.type_conv
Since we're not using those functions as argparse callbacks anymore, we
can write a normal function instead of factories, which simplifies
things a lot.
2016-05-18 06:55:27 +02:00
Florian Bruhin
c0d044447d Add tests for qutebrowser.utils.typing 2016-05-18 06:55:17 +02:00
Florian Bruhin
6ed9b6b13f Make sure typing.Union[str, int] gets handled
str always needs to be the last element checked as otherwise it'd always
win.
2016-05-18 06:55:17 +02:00
Florian Bruhin
a0d0b6464f Use typing.py-like annotations for command args
This means:

- An annotation like (int, str) is now typing.Union[int, str].
- utils.typing got expanded so it acts like the real typing.py, with
  issubclass() working properly with typing.Union and __union_params__
  being set.
- A literal string doesn't exist anymore as annotation, instead
  @cmdutils.argument now has a 'choices' argument which can be used like
  @cmdutils.argument('arg', choices=['val1', 'val2']).
- Argument validating/converting is now entirely handled by
  argparser.type_conv instead of relying on python's argparse, i.e.
  type/choices is now not passed to argparse anymore.
2016-05-18 06:55:17 +02:00
Florian Bruhin
3a33bc42a6 Add initial support for the typing module 2016-05-18 06:55:17 +02:00
Florian Bruhin
9694374673 Add test for cmd arg types 2016-05-18 06:55:17 +02:00
Florian Bruhin
c33f0c3512 Use @cmdutils.argument for completions 2016-05-18 06:55:17 +02:00
Florian Bruhin
3ab40bbc23 Clear globals correctly for all cmdutils tests
TestArgument didn't clear the globals as the fixture was inside
TestRegister.

This means test_run_vulture failed in funny ways because run_vulture.py
generated a whitelist containing "<locals>" for commands:

    tests/unit/scripts/test_run_vulture.py:55: in run
        return run_vulture.run([str(e.basename) for e in files])
    scripts/dev/run_vulture.py:146: in run
        vult.scavenge(files + [whitelist_file.name])
    .tox/py35/lib/python3.5/site-packages/vulture.py:107: in scavenge
        self.scan(module_string)
    .tox/py35/lib/python3.5/site-packages/vulture.py:75: in scan
        node = ast.parse(node_string, filename=self.file)
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    source = 'qutebrowser.browser.commands.CommandDispatcher.buffer\nqutebrowser.misc.savemanager.SaveManager.save_command\nqutebro...iidoc.UsageFormatter._get_default_metavar_for_positional\nscripts.dev.src2asciidoc.UsageFormatter._metavar_formatter\n'
    filename = '/tmp/tmp_ein2umn', mode = 'exec'

        def parse(source, filename='<unknown>', mode='exec'):
            """
            Parse the source into an AST node.
            Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
            """
    >       return compile(source, filename, mode, PyCF_ONLY_AST)
    E         File "/tmp/tmp_ein2umn", line 16
    E           test_cmdutils.TestArgument.test_wrong_order.<locals>.fun
    E                                                       ^
    E       SyntaxError: invalid syntax
2016-05-18 06:55:17 +02:00
Florian Bruhin
c14db202d6 Use @cmdutils.argument to hide arguments 2016-05-18 06:55:17 +02:00
Florian Bruhin
2370793f38 Make win_id/count mutually exclusive for ArgInfo 2016-05-18 06:55:17 +02:00
Florian Bruhin
35135c4b0d Use @cmdutils.argument for win_id/count 2016-05-18 06:55:17 +02:00
Florian Bruhin
04367851c3 Refactor how cmdutils.ArgInfo works
It's now a real class, and some other aspects about how it's handled
were cleaned up as well.
2016-05-18 06:55:17 +02:00
Florian Bruhin
9eeaeb95c3 Make sure @cmdutils.argument after @register fails 2016-05-18 06:55:17 +02:00
Florian Bruhin
3c586f34ff Add a @cmdutils.argument decorator
For now the only available keyword argument is 'flag' which customizes
the flag an argument will get.

See #637.
2016-05-18 06:55:17 +02:00
Florian Bruhin
ee579b4bc3 Add a script to strip trailing whitespace
Obsoletes #1498
2016-05-18 06:37:26 +02:00
Liam BEGUIN
f689cca101 Added missing All group 2016-05-17 23:57:36 -04:00
Liam BEGUIN
ce0d23bd10 Added tests for the inputs group 2016-05-17 19:58:48 -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
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
Panagiotis Ktistakis
224c877fec Hide passwords in hovering URLs 2016-05-15 19:07:10 +03:00
Florian Bruhin
9b28d90543 Improve output if :messages is used without errors 2016-05-15 11:50:29 +02:00
Florian Bruhin
b704c911ae Fix running qute:log and qute:plainlog
This failed because dict.get('level') returned None with no level
parameter, and the subsequent [0] raised:

    Traceback (most recent call last):
      File ".../qutebrowser/utils/utils.py", line 624, in wrapper
        return func(*args, **kwargs)
      File ".../qutebrowser/browser/network/networkmanager.py", line 445, in createRequest
        op, req, outgoing_data)
      File ".../qutebrowser/browser/network/qutescheme.py", line 107, in createRequest
        data = handler(self._win_id, request)
      File ".../qutebrowser/browser/network/qutescheme.py", line 189, in qute_log
        level = urllib.parse.parse_qs(request.url().query()).get('level')[0]
    TypeError: 'NoneType' object is not subscriptable
2016-05-15 11:33:30 +02:00
Florian Bruhin
e21039094d Merge branch 'messages' of https://github.com/rcorre/qutebrowser into rcorre-messages 2016-05-15 11:20:06 +02:00
Florian Bruhin
b75d1629a8 Merge branch 'set-cmd-text-variables' of https://github.com/forkbong/qutebrowser into forkbong-set-cmd-text-variables 2016-05-15 11:01:58 +02:00
Panagiotis Ktistakis
c88883fcb3 Decode URL in statusbar when hovering over it 2016-05-14 19:52:24 +03:00
Ryan Roden-Corrent
fcd233a675 Clean up :messages implementation.
- Add log.LOG_LEVELS to map names to levels (instead of using
  logging._levelToName)
- Test that log pages do not contain messages below the requested level
- Use pythons urllib.parse.parse_qs instead of Qt's UrlQuery
- Document tab, bg, window args for :messages
- Clean up style
2016-05-14 12:45:22 -04:00
Panagiotis Ktistakis
9527712daa Add tests for {url:pretty} in :set-cmd-text 2016-05-14 18:44:05 +03:00
Ryan Roden-Corrent
c36f760114 Add bdd test for page not containing plaintext.
You can now use 'the page should not contain the plaintext ...' in a
feature test.
2016-05-14 07:10:58 -04:00
Ryan Roden-Corrent
800c1c3cf8 Add :messages command to show past messages.
This adds a 'level' query parameter to qute://log and qute://plainlog.
For example, qute://log?level=warning will show an html page containing
log entries with severity warning or greater.
If the query is omitted, the original behavior of qute://log is
preserved.

:messages [level] is a command that opens qute://log?level=<level>.
By default, level defaults to 'error' as an easy way to see missed
error messages.
2016-05-14 07:10:58 -04:00
Florian Bruhin
c64e5c9bd5 Get rid of the colorlog dependency
colorlog was problematic for various reasons:

- Not commonly packaged for Linux distributions
- Calling colorama.init() automatically on import
- Not supporting {foo} log formatting
- Not supporting an easy way to turn colors off

Instead we now do the log coloring by hand, which is simpler and means
everyone will have colored logs.
2016-05-13 21:19:33 +02:00
Panagiotis Ktistakis
38edb1b16d Properly replace variables in set-cmd-text command
This fixes #123 and allows variables like {url:pretty} to be used with
set-cmd-text
2016-05-13 18:12:53 +03:00
Florian Bruhin
cb27dbbfb5 Fix error message check for :bind test 2016-05-10 23:47:16 +02:00
Florian Bruhin
ea243ae022 Renumber keybindings in keyinput.feature
An unique keybinding for each test means we have some level of
isolation and can understand error messages more easily.

As we're >10 now, let's use a leading zero to avoid shadowed
keybindings.
2016-05-10 23:46:02 +02:00
Florian Bruhin
24d16dd0a7 Merge branch 'show_binding2' of https://github.com/rcorre/qutebrowser into rcorre-show_binding2 2016-05-10 23:39:32 +02:00
Florian Bruhin
36da07c73b Fix lint 2016-05-10 07:56:54 +02:00
Florian Bruhin
5eff35ba30 cmdutils.register: annotation -> arg for flags
Instead of using a 'flag' key in the annotation dict, we now use a flags
argument to @cmdutils.register which is a {argument: flag} dict.

See #637.
2016-05-10 07:35:41 +02:00
Florian Bruhin
49fb981e7f Add test for completion count in cmdutils.register 2016-05-10 07:12:50 +02:00
Florian Bruhin
9ca5acd546 Add tests for flags with @cmdutils.register 2016-05-10 07:00:10 +02:00
Florian Bruhin
b17ecd1376 Add tests for cmdutils.register/star_args_optional 2016-05-10 06:41:42 +02:00
Florian Bruhin
56f1d885f9 Use parens instead of \ to continue line 2016-05-09 07:18:12 +02:00
Florian Bruhin
a8845be9e6 Merge branch 'bdd_test_insert_mode' of https://github.com/phansch/qutebrowser into phansch-bdd_test_insert_mode 2016-05-09 07:15:10 +02:00
Florian Bruhin
f7dc9b54bd Add a test for #846 2016-05-09 07:06:58 +02:00
Florian Bruhin
a23aa1cc47 Fix broken supports_selection() test 2016-05-08 22:39:39 +02:00
Florian Bruhin
165504c1f2 bdd: Fix clipboard_contains_multiline 2016-05-08 22:09:19 +02:00
Florian Bruhin
b9b6f357da Add utils.supports_selection() 2016-05-08 22:06:59 +02:00
Florian Bruhin
3e6ac28c66 Fix ;Y on systems not supporting primary selection
Instead we paste clipboard like we already do with some other commands
when primary selection is not supported.

Fixes #1336
2016-05-08 21:59:25 +02:00
Florian Bruhin
4d9a98a11d Paste clipboard with :paste-primary on Windows 2016-05-08 21:18:57 +02:00
Florian Bruhin
ddc1f803c0 Clean up assertion 2016-05-08 20:01:35 +02:00
Florian Bruhin
f49cc4e901 Only keep contain tests 2016-05-08 19:57:59 +02:00
Florian Bruhin
65ed878dcf Update copyright 2016-05-08 19:57:18 +02:00
Florian Bruhin
fdb28e4c71 Add test_sortfilter from #950 2016-05-08 19:56:41 +02:00
Florian Bruhin
f306ca9b53 Fix lint 2016-05-08 11:14:42 +02:00
Florian Bruhin
b4272975f2 Revert "Use lists instead of tuples"
This reverts commit eb5bfc1659.
2016-05-08 11:09:47 +02:00
Florian Bruhin
4403f02ac5 Fix HostBlocker.on_config_changed with no datadir 2016-05-07 23:35:30 +02:00
Florian Bruhin
6d1764e732 Clear blocked hosts on start correctly 2016-05-07 23:31:35 +02:00
Florian Bruhin
f6544786c1 dict 2016-05-07 22:41:22 +02:00
Florian Bruhin
2d8bde62a5 docstring 2016-05-07 22:39:53 +02:00
Florian Bruhin
9e64e5eab4 Check CommandError exception value 2016-05-07 22:39:09 +02:00
Florian Bruhin
f4f329714d Reformat dicts 2016-05-07 22:38:37 +02:00
Florian Bruhin
1a03388fb5 Fix docstrings 2016-05-07 22:28:06 +02:00
Florian Bruhin
eb5bfc1659 Use lists instead of tuples 2016-05-07 22:12:28 +02:00
Florian Bruhin
bc8d19f003 Fix typo 2016-05-07 22:09:43 +02:00
Florian Bruhin
2ae8ecff71 Use qapp fixture in all adblock tests 2016-05-07 22:08:55 +02:00
Florian Bruhin
7db6f52fa1 Merge branch 'test_adblock' of https://github.com/jcorentin/qutebrowser into jcorentin-test_adblock 2016-05-07 22:06:43 +02:00
Daniel Schadt
dcac832f5e netmanager: fix crash when asking with no tab_id
Issue 1413

This happens when the networkmanager is used by something that has no
tab_id, like the generic DownloadManager. In this case, we should just
skip the webview connection (as it makes no sense) instead of crashing
(which is the last thing we want to do).
2016-05-05 00:34:16 +02:00
Florian Bruhin
3f66ea1a10 Stabilize buffer test, attempt 2
"Current tab changed" actually waited for an unrelated earlier event.
2016-05-04 20:56:54 +02:00
Florian Bruhin
7a82c13b27 bdd: Also log already found log messages 2016-05-04 20:54:34 +02:00
Ryan Roden-Corrent
2536766cac Run :bind <key> to print the current binding.
The <command> arg is now optional. If omitted, :bind prints the current
binding as a message. If --mode is given, the binding for that mode is
printed.
2016-05-03 23:29:34 -04:00
Ryan Roden-Corrent
98508bdd26 Allow flexible whitespace in color strings.
Allow a variable amount of whitespace for rgb, rgba, hsv, and hsva
strings in the config.
Previously only 'rgb(0, 0, 0)' was allowed. Now things like
'rgb(0,0,0)' are permitted.
The repeated 3-digit segments of the regexes were separated out to
reduce repetition and line length.
2016-05-03 23:15:39 -04:00
Florian Bruhin
8fb1d568ee tests: Actually log the colored log 2016-05-01 23:01:22 +02:00
Florian Bruhin
43908dba20 Use colored logging for end-to-end tests 2016-05-01 22:45:21 +02:00
Florian Bruhin
4e333d61cd Clean up failed userscripts correctly 2016-05-01 22:13:52 +02:00
Florian Bruhin
e3f1949f57 bdd: Fix parsing of logged python warnings 2016-05-01 22:13:31 +02:00
Florian Bruhin
7b575460d5 Fix URL for :quickmark-save test
We never noticed this because CherryPy handled this incorrectly in
versions < 5.3.0
2016-04-30 19:08:36 +02:00
Florian Bruhin
2b890901ae Unskip :stop test on OS X
CherryPy now ignores EPROTOTYPE on OS X with 5.3.0, so we can safely
reenable the test.
2016-04-30 18:43:31 +02:00
Florian Bruhin
48c7eee6f6 Release v0.6.2 2016-04-30 18:16:43 +02:00
Florian Bruhin
43d898aa63 Fix log tests 2016-04-30 17:45:45 +02:00
Florian Bruhin
89caf3f497 Add a test for #1464 2016-04-30 14:29:55 +02:00
Florian Bruhin
580f3ed7dc Remove added blank line 2016-04-30 14:09:14 +02:00
Florian Bruhin
b5aad7d1b9 Merge branch 'issue-1393' of https://github.com/NoctuaNivalis/qutebrowser into NoctuaNivalis-issue-1393 2016-04-30 14:06:54 +02:00
Felix Van der Jeugt
86d08f741c shorten page and wait for load finished 2016-04-29 21:56:24 +02:00
Florian Bruhin
2d5ffbfd02 Revert "Handle counts for special keys."
This reverts commit c881730fad.

This is just a temporary solution until we can properly fix this.

See #1464
2016-04-29 14:20:11 +02:00
Florian Bruhin
8b227f4ba4 Merge branch 'special_key_count' of https://github.com/rcorre/qutebrowser into rcorre-special_key_count 2016-04-28 22:22:23 +02:00
Florian Bruhin
076b486368 Merge branch 'issue-1412' of https://github.com/Kingdread/qutebrowser into Kingdread-issue-1412 2016-04-27 21:19:04 +02:00
Florian Bruhin
ebfcce172b Stabilize :buffer tests 2016-04-27 21:08:16 +02:00
Florian Bruhin
2a343cb3a1 Various code style improvements 2016-04-27 20:25:27 +02:00
Daniel Schadt
e8aa242d10 tests: fix invocation test for --cachedir
--cachedir="" doesn't work because the quotes are not processed (as they
would be by the shell) and the cachedir is set to ./"" (that is a
directory with two double quotes as name). The correct start parameter
is thus --cachedir=, which correctly fails when the fix is reverted.
2016-04-27 13:02:18 +02:00
Daniel Schadt
951cab237f tests: factor out common code in test_invocations 2016-04-27 00:04:03 +02:00
Daniel Schadt
758fb94414 tests: add test for DiskCache with cache_dir=None 2016-04-27 00:04:02 +02:00
Daniel Schadt
c0b372591a tests: add tests for --cachedir="" 2016-04-26 23:26:35 +02:00
Florian Bruhin
7c3361d8da Stabilize :download-delete test 2016-04-26 22:56:06 +02:00
Felix Van der Jeugt
b7ba3cd53e fix flake and pep remarks 2016-04-26 22:52:29 +02:00
Felix Van der Jeugt
2d71c541c6 allow swapping dict at runtime 2016-04-26 22:52:29 +02:00
Felix Van der Jeugt
ae72841856 read the wait_for code 2016-04-26 22:52:29 +02:00
Felix Van der Jeugt
9633e79d87 why don't I even know my own options 2016-04-26 22:52:29 +02:00
Felix Van der Jeugt
7d9d4937aa initial testing - local tox does not work yet 2016-04-26 22:52:29 +02:00
Florian Bruhin
32d64b1a9a Merge branch 'undo_crash' of https://github.com/rcorre/qutebrowser into rcorre-undo_crash 2016-04-25 19:19:08 +02:00
Florian Bruhin
d6c72c5821 Merge branch 'develop' of https://github.com/kanikaa1234/qutebrowser into kanikaa1234-develop 2016-04-25 19:03:20 +02:00
Florian Bruhin
6349c00c72 Fix crash with :tab-{prev,next,focus} with 0 tabs
When using :tab-prev/:tab-next (or :tab-focus which uses :tab-next
internally) immediately after the last tab, those functions could be
called with 0 tabs open, which caused a ZeroDivisionError when trying to
do % 0.

Fixes #1448.
2016-04-25 18:55:15 +02:00
Florian Bruhin
ef91fa3821 Merge branch 'marks' of https://github.com/rcorre/qutebrowser into rcorre-marks 2016-04-21 20:05:41 +02:00
Florian Bruhin
46a525d0d7 bdd: Improve test IDs for :buffer tests 2016-04-21 19:47:26 +02:00
Florian Bruhin
10fe9cf32d Stabilize test_buffer_two_window_index_present
Fixes #1440
I'm not sure if this was the case, but probably it was.
2016-04-21 19:34:39 +02:00
Ryan Roden-Corrent
399cddf7ac Actually test double-undo. 2016-04-21 08:04:20 -04:00
Ryan Roden-Corrent
ccd04ca548 Don't crash when undoing twice on default page.
Avoid a crash when undoing twice on the default page with last-close set to
default-page.
This was caused by logic to reuse the current tab if it is on the default page
and has no history. The fix is using openurl rather than removeTab/tabopen.
2016-04-21 08:04:20 -04:00
Ryan Roden-Corrent
600b5082a9 Touch up tests and add pyqtSlot for marks.
Small code review changes.
2016-04-20 21:53:12 -04:00
Florian Bruhin
a55952375b bdd: Improve output when comparing sessions
See #1440.
2016-04-21 00:15:37 +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
cd128bec8e bdd: __tracbackhide__ in QuteProcess._wait_for_*
This should improve the output we got here:
https://ci.appveyor.com/project/The-Compiler/qutebrowser/build/master-2404/job/gr7m54km6h6nul04
2016-04-20 22:39:52 +02:00
Florian Bruhin
e18b056877 Merge branch 'pretty_url' of https://github.com/forkbong/qutebrowser into forkbong-pretty_url 2016-04-20 22:15:54 +02:00
Florian Bruhin
6a6285495a Merge branch 'pretty_url_2' of https://github.com/forkbong/qutebrowser into forkbong-pretty_url_2 2016-04-20 20:56:24 +02:00
Panagiotis Ktistakis
8550fb3401 Add tests for {url:pretty} variable 2016-04-20 17:58:14 +03:00
Philipp Hansch
dfc1e5703a Cleanup unused files 2016-04-20 16:23:18 +02:00
Philipp Hansch
376c5c458e Convert insert mode tests to non-bdd tests 2016-04-20 16:19:47 +02:00
Philipp Hansch
ff13921aad Add tests for auto-[leave-]insert-mode 2016-04-20 12:50:33 +02:00
Philipp Hansch
601687ba61 Add insert mode feature tests
Issue-Link: #999
2016-04-20 11:04:53 +02:00
Florian Bruhin
22582773b1 Fix lint 2016-04-20 09:00:01 +02:00
Florian Bruhin
bc815505f1 bdd: Output fewer = chars for summary headers
Otherwise we have line breaks on Travis CI
2016-04-20 07:55:59 +02:00
Florian Bruhin
4520261884 bdd: Make TestProcess.log_summary public
We want to use it from the BDD conftest.py
2016-04-20 07:55:23 +02:00
Florian Bruhin
6cf4cebfd4 bdd: Show messages we're waiting for in the log 2016-04-20 07:49:08 +02:00
Florian Bruhin
a99cb5f6b2 bdd: Improve wait_for_load_finished output 2016-04-20 07:38:32 +02:00
Florian Bruhin
5e91ad6c42 bdd: Shorten InvalidLine exception output 2016-04-20 07:38:32 +02:00
Florian Bruhin
266bc6e8d8 bdd: Don't shorten log if an exception happened 2016-04-20 07:38:32 +02:00
Florian Bruhin
1579f27564 bdd: Add sections to log
See #1418
2016-04-20 07:38:12 +02:00
Ryan Roden-Corrent
c881730fad Handle counts for special keys.
Now 3<ctrl-o> will execute whatever <ctrl-o> is mapped to with count=3.
2016-04-19 23:39:02 -04:00
Ryan Roden-Corrent
0755e163bb Only set the ' mark on normal/current hinting.
Don't set ' for downloading, hovering, or opening a link in a tab.
2016-04-19 21:18:20 -04:00
kanikaa1234
fae005ab7f :navigate: command and test feature 2016-04-19 20:30:20 +05:30
Florian Bruhin
6aaea2aa31 Fix HeaderDict with an empty value 2016-04-19 09:43:54 +02:00
Florian Bruhin
e860d8cfea Add a custom-headers setting
Supersedes #1132
Closes #1020.
2016-04-19 06:35:32 +02:00
Florian Bruhin
c5999443a1 Implement a HeaderDict config type
Supersedes #1132.
Fixes #1022.
2016-04-19 06:35:20 +02:00
Panagiotis Ktistakis
bd6783c7e6 Add --pretty flag to :yank
With --pretty, the URL is yanked in a "pretty form", with most
percent-encoded characters decoded. Partially fixes #1372.
2016-04-18 23:10:53 +03:00
Ryan Roden-Corrent
2b68aaa311 Make set_mark searching tests less flaky.
Replace all the html numbers with a few widely spaced divs to guarantee the
search will move the viewport on almost and reasonable screen size.
2016-04-18 12:30:16 -04:00
Ryan Roden-Corrent
a924144d9a Set ' mark after searching.
Allow jumping back to the previous position after a search jumps you around.
2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
4b00a17d71 Fix MarkKeyParser crash when changing keyconfig.
Ensure MarkKeyParser implements on_keyconfig_changed, so it doesn't fail when
rebinding a key. It doesn't have keybindings, so the implementation is just
`pass`.

This also fixes a few flake8 style errors.
2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
be6308534f Store both x and y position for marks.
Previously only stored/used y.
2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
e684cfa03f Trivial fixes for marks based on code review.
- Fix a docstring copy-paste
- Add own name/copyright date to new file
- Simplify a bdd expression (no need for regex)
- Scroll to a pixel position in a single operation
2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
540f4af225 Set the ' mark after following a link.
This moves mark storage from CommandDispatcher to TabbedBrowser, so it can also
be accessed by the HintManager.
2016-04-17 21:04:08 -04:00
Ryan Roden-Corrent
dc246772e7 Add integration tests for set-mark and jump-mark. 2016-04-17 21:04:08 -04:00
Jakub Klinkovský
0eab422540 tests: replace paths to data/hints/link.html
an adjustment due to 35ed70cfe0
2016-04-15 23:19:08 +02:00
Jakub Klinkovský
3265601eab Merge remote-tracking branch 'upstream/master' into hints_clicking
* upstream/master: (327 commits)
  Remove unused import
  tox: Update Werkzeug to 0.11.8
  Regenerate authors
  Use __file__ instead of sys.argv[0]
  Regenerate authors
  Make update_3rdparty.py install correctly when run from any directory
  Open command line urls explicitly.
  tox: Update Werkzeug to 0.11.6
  Move qutebrowser.rcc to misc/
  Regenerate resources
  Fix CHANGELOG/link in README
  New qutebrowser logo!
  www: Add releases link
  Release v0.6.1
  release checklist: Clarify how to build on Windows
  Make sure the cheatsheet PNG is included in sdist
  Fix cheatsheet link URL in quickstart
  Mark segfault on exit in test_smoke as xfail
  Add a xfail test for #797
  Add missing file
  ...

Conflicts:
	tests/integration/features/hints.feature
2016-04-15 22:37:47 +02:00
Florian Bruhin
c690e652dc Release v0.6.1 2016-04-10 21:25:32 +02:00
Florian Bruhin
0776aaf32c Mark segfault on exit in test_smoke as xfail
See #1387.
I know this is... less than optimal, but I can't do anything :-/
2016-04-10 20:52:07 +02:00
Florian Bruhin
6e7aefca00 Add a xfail test for #797 2016-04-10 20:30:26 +02:00
Florian Bruhin
3409559958 Add missing file 2016-04-10 20:28:10 +02:00
Florian Bruhin
6989d4d210 Fix downloading of non-ascii files with LC_ALL=C
Fixes #908.
2016-04-10 20:16:40 +02:00
Florian Bruhin
98f0938d35 Rename test_cmdline_args to test_invocations 2016-04-10 19:56:44 +02:00
Florian Bruhin
1954ebd63c Fix test_last_window_session_none 2016-04-10 18:22:58 +02:00
Johannes Martinsson
570d8b4abe Make tab-focus count from end with negative index
This makes it possible to jump to the very last tab, as opposed to the
last focused tab, by using -1 as the index. Generally negative indexes
are counted from the end.

Solves issue #1166
2016-04-09 03:40:36 +02:00
Florian Bruhin
642dc46ba9 flake8: Add hacking 2016-04-08 07:35:53 +02:00
Florian Bruhin
00873fd000 Fix Proxy configtype test 2016-04-07 21:42:26 +02:00
Florian Bruhin
9ea7716b06 Stop supporting running tests without Xvfb/DISPLAY
This always caused problems and unneeded complexity in the past, and it
also increases Travis CI runtime.

We now require either a DISPLAY during tests or Xvfb being installed.
2016-04-06 08:27:43 +02:00
Florian Bruhin
d02d99e53e bdd: Make quteproc.set_setting work with quotes
This hopefully fixes editor BDD tests on Windows as the editor path is
now correctly quoted.
2016-04-06 08:13:43 +02:00
Florian Bruhin
7141941ece Fix lint 2016-04-06 07:17:13 +02:00
Florian Bruhin
f0b66130d6 Merge branch 'rcorre-edit-url' 2016-04-06 06:52:43 +02:00
Florian Bruhin
86dec02fe8 bdd: Add tests for :edit-url 2016-04-06 06:47:19 +02:00
Florian Bruhin
2f520f3b17 Rename test_editor.py to test_editor_unit.py 2016-04-05 19:49:01 +02:00
Florian Bruhin
537d017ec2 @Kingdread is faster than AppVeyor 2016-04-05 14:11:51 +02:00
Florian Bruhin
0abd16f6e5 tests: Use repr to wait for download question
The tests failed on Windows because a double-slash was printed in the
logs, but the tests expected a single one.
2016-04-05 14:09:25 +02:00
Florian Bruhin
860853f66f Fix lint 2016-04-05 12:40:46 +02:00
Florian Bruhin
ebee06a9c4 bdd: Add tests for download-path-suggestion 2016-04-05 11:43:35 +02:00
Florian Bruhin
c67edcf811 tests: Add v0.6.0 config to test_old_config 2016-04-04 18:16:31 +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
6631c6456c Merge branch 'session-tests' 2016-04-01 06:15:52 +02:00
Florian Bruhin
aad2407de1 Merge branch 'force-current-tab' of https://github.com/paretje/qutebrowser into paretje-force-current-tab 2016-04-01 06:13:08 +02:00
Kevin Velghe
0652637fbe Refactor unit tests for remove_blank_target 2016-04-01 01:32:27 +02:00
Florian Bruhin
d30093b877 Skip "Focusing download widget via Tab" on old Qt
Qt < 5.3.1 (used on Travis with Ubuntu Trusty) has a bug with its
javascript prompt implementation, so we can't run that test there.
2016-03-31 21:12:13 +02:00
Florian Bruhin
89742beb4e pylint: useless-suppression in test_qt_javascript
When QtWebEngine is available, the suppression is useless.
2016-03-31 20:18:26 +02:00
Florian Bruhin
27b31b7ded Avoid DownloadView being focused when pressing tab
The previous fix didn't work in situations where the web view was
actually focused, but had no focused element (like about:blank).

The new fix always works, and even is a lot simpler!

Fixes #504.
2016-03-31 19:45:36 +02:00
Florian Bruhin
123fd18af5 Fix crash when removing download in closed window
When a download is finished with `removed-finished-download` set to a
delay, it's removed via a singleshot QTimer.

However, when the window was closed in the meantime, the slot still was
executed by Qt, even though the DownloadManager was already deleted.

Fixes #1242
2016-03-31 19:09:43 +02:00
Kevin Velghe
e90ad3d9c0 Complete coverage for webelem 2016-03-31 10:25:44 +02:00
Kevin Velghe
ef6ffd6a3a Add link_span.html 2016-03-31 09:36:13 +02:00
Jimmy
97ab6db655 Adds tests for buffer command.
The buffer_troubling_args tests may look a little un-intuitive but that is
because they are testing the edge cases for the current behaviour. If these
edge cases are encountered during normal usage you are doing something wrong.
2016-03-31 14:00:36 +13:00
Kevin Velghe
0432ba68c6 Add hints integration test 2016-03-30 23:53:18 +02:00
Kevin Velghe
00f1e699d4 Add extra test to test_remove_blank_target 2016-03-30 23:46:02 +02:00
Florian Bruhin
a6a2210ce8 Add tests for #879 2016-03-30 22:16:36 +02:00
Kevin Velghe
dd4710d596 Fix test_remove_blank_target 2016-03-30 19:54:42 +02:00
Kevin Velghe
f4f926cdca Add integration tests for current target hints 2016-03-30 19:49:25 +02:00
Kevin Velghe
a432102be0 Add webelem tests for remove_blank_target 2016-03-30 19:08:37 +02:00
Florian Bruhin
5a5e8167dd Fix lint 2016-03-29 23:20:39 +02:00
Florian Bruhin
6c7e2492e9 Merge branch 'dirbrowser-issue-1334' of https://github.com/Kingdread/qutebrowser into Kingdread-dirbrowser-issue-1334 2016-03-29 22:38:04 +02:00
Florian Bruhin
fc7e75c355 Fix lint 2016-03-29 22:30:26 +02:00
Florian Bruhin
4067d38cb0 Add some tests for QtWebKit/Engine JS capabilities 2016-03-29 22:08:49 +02:00
Florian Bruhin
fee3b9a02b Merge branch 'bdd_test_spawn_command' of https://github.com/phansch/qutebrowser into phansch-bdd_test_spawn_command 2016-03-29 21:12:29 +02:00
Florian Bruhin
de5ecbf4e7 Fix lint 2016-03-29 21:10:29 +02:00
Daniel Schadt
bd5b1f207d fix lint 2016-03-29 21:02:54 +02:00
Daniel Schadt
3007fbf5c2 tests: add tests for quteproc.click_element 2016-03-29 20:52:23 +02:00
Daniel Schadt
f82d0f0c94 quteprocess: properly escape xpath expression
Since XPath doesn't have a way to escape quotes (or any other
character), we have to use a workaround by using concat() and switching
between quoting styles.
2016-03-29 20:34:40 +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
4a1ba45efa Merge remote-tracking branch 'upstream/master' into bdd_test_spawn_command 2016-03-29 19:24:43 +02:00
Florian Bruhin
f43cbed72f tests: Inherit HTTPPostStub from QObject
This way we can test the actual signals instead of calling
on_client_success by hand.
2016-03-29 19:22:28 +02:00
Florian Bruhin
25555682dc Merge branch 'master' of https://github.com/arsana7/qutebrowser into arsana7-master 2016-03-29 18:59:06 +02:00
Philipp Hansch
5ae0b0cf87 Ignore test on Windows
The userscript is a bash script and there is no bash on windows.
One solution could be to use a python userscript, but there may be
other issues (file associations), too.
2016-03-29 14:17:47 +02:00
Daniel Schadt
b6c5ff25fd tests: add click_element to quteprocess 2016-03-29 13:32:35 +02:00
Philipp Hansch
8a619ea84c Prevent slashes from being stripped on Windows 2016-03-29 13:25:04 +02:00
Daniel Schadt
f085eb6eca tests/dirbrowser: move parse out of DirLayout 2016-03-29 12:43:50 +02:00
Daniel Schadt
2db5b95552 tests: use "if not parent_elem"
Also add a new test for browsing the root directory
2016-03-29 12:36:43 +02:00
Philipp Hansch
b1ecdf2924 Try to fix path issue on windows 2016-03-29 12:11:01 +02:00
Florian Bruhin
f15fb16ad4 Fix small nitpick 2016-03-29 07:09:17 +02:00
Florian Bruhin
606471c4b6 Merge branch 'test_statusbar_url' of https://github.com/craftyguy/qutebrowser into craftyguy-test_statusbar_url 2016-03-29 07:07:45 +02:00
Philipp Hansch
c016c77da4 Try to fix Windows path issue with new custom step
On windows, using '/' in pathnames won't work, so it's impossible to use
to describe a path in a feature spec. The solution is to move the path
logic out of the feature spec and hand it over to `os.path.join` in a
new custom step for userscripts.
2016-03-29 01:37:40 +02:00
Clayton Craft
c811db5424 remove unused import 2016-03-28 15:31:28 -07:00
Clayton Craft
e0c0613db6 Added new test for simulating loading page and hover/unhover URL 2016-03-28 15:12:16 -07:00
Philipp Hansch
e9ae2156d3 Comply with flake8 2016-03-29 00:08:14 +02:00
Philipp Hansch
449adc2dc1 Try not to confuse syntax highlighting with quotes 2016-03-28 23:53:26 +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
Daniel Schadt
6a96e1d6d8 quteprocess: remove duplicate code 2016-03-28 23:10:20 +02:00
Daniel Schadt
c0b40aefdd tests/dirbrowser: normalize paths before comparing
This avoids errors because some libraries use '/' even on windows, while
others use '\' on windows.
2016-03-28 23:10:20 +02:00
Daniel Schadt
f6e8815871 tests: add integration tests for dirbrowser 2016-03-28 23:10:20 +02:00
Daniel Schadt
5e73a2ea37 dirbrowser: move parent dir logic to own function 2016-03-28 23:10:20 +02:00
Daniel Schadt
e97b10517f tests: use file_url for dirbrowser tests
Otherwise the tests will fail on windows.
2016-03-28 23:10:20 +02:00
Daniel Schadt
700756aa16 tests: add more cases for dirbrowser.is_root
The trailing slash might have an effect on the function result, so we
should have cases with/without the slash.
2016-03-28 23:08:54 +02:00
Clayton Craft
32304f36dd fix pylint failure 2016-03-25 16:35:49 -07:00
Florian Bruhin
387e35d3e5 Fix lint 2016-03-26 00:24:54 +01:00
Florian Bruhin
9edc5a665e Handle jinja's UndefinedError in jinja.render
We can get UndefinedError when a new function got added to the jinja
env (and gets called from a template) and the user did update the
on-disk templates but not restart qutebrowser yet.

In this case, let's show a special error page to the user and tell them
to do :report in the unlikely case it's actually a bug.

Fixes #1362.
See #1360.
2016-03-26 00:00:06 +01:00
Clayton Craft
4778ff6f9c Cleaned up url test and improved coveraged based on feedback 2016-03-25 15:56:39 -07:00
Philipp Hansch
0083538491 Add basic test for spawning userscripts 2016-03-25 18:21:38 +01:00
Philipp Hansch
69da5d7545 Add BDD tests for spawn command
Issue-Link: https://github.com/The-Compiler/qutebrowser/issues/999
2016-03-25 18:19:35 +01:00