Commit Graph

335 Commits

Author SHA1 Message Date
Ryan Roden-Corrent
38bb3673db Preserve a backup if editor callback fails.
Currently the editor deletes its temp file whenever editing is finished.
With this patch, the file will not be deleted if the editor callback
encounters an exception.

One example is if the tab containing the edited element is closed. The
editor errors with "Edited element vanished", but with this patch it
will also print "Backup at ..." so the user does not lose their work.

Resolves #1596.

Supersedes #3641, using the cleaner approach started in #1677.
2018-03-12 08:34:50 -04:00
Florian Bruhin
155a1901c0 Merge branch 'keys' 2018-03-04 22:50:41 +01:00
Florian Bruhin
fac8d72d8c Capitalize Escape in TestFullscreenNotification 2018-03-04 20:21:57 +01:00
Florian Bruhin
53fb5af99c Paste version information privately 2018-02-26 23:09:55 +01:00
Florian Bruhin
321d5c5d20 Merge branch 'master' into keys 2018-02-25 21:25:12 +01:00
George Edward Bulmer
29ff4259d6 Add test for _uptime() 2018-02-13 20:09:19 +00:00
George Edward Bulmer
ca8d935cf4 Update tests as per code review 2018-02-13 18:38:27 +00:00
Florian Bruhin
15fecc962d Fix lint 2018-02-08 11:41:58 +01:00
Florian Bruhin
c520130389 Add tests for a failing watch/unwatch 2018-02-08 10:29:23 +01:00
Florian Bruhin
3306247ae5 Merge branch 'editor-watch' 2018-02-07 22:31:49 +01:00
Florian Bruhin
abd56a5abd Wait until the mtime changed 2018-02-07 21:40:03 +01:00
Florian Bruhin
6f028e9ad0 Update copyright years 2018-02-05 12:19:50 +01:00
Ryan Roden-Corrent
a8733d7228 Increase timeout in test_editor.
The test with watch=True was failing on the Travis OSX environment
becausee it was timing out before the file_updated signal was fired.
2018-02-04 07:02:25 -05:00
Ryan Roden-Corrent
833df95485 Only detect save for open-editor and config-edit.
Scope down the new trigger-on-save behavior to only open-editor and
config-edit. Other uses of the editor such as edit-url and edit-command
will behave as before.
2018-02-03 19:57:47 -05:00
Ryan Roden-Corrent
530a1859a3 Trigger editor signal on exit if content changed.
With the previous code, the editor could miss the final signal on a
save-and-exit. This is avoided by always running the file changed
handler on a successful exit, but only firing the signal if the content
actually changed (to avoid double-signalling).
2018-01-27 15:03:18 -05:00
Ryan Roden-Corrent
a940de3717 Rename editing_finished to file_updated.
ExternalEditor now fires an event on save rather than on exit, so the
signal name should be updated to match the behavior.
2018-01-27 15:03:18 -05:00
Ryan Roden-Corrent
23eb6a6c53 Fix test_editor for edit-on-write behavior.
Now that the editor fires editing_finished on every write, the unit
tests had to be updated.

- Add qtbot to the editor fixture to resolve `QtWarningMsg:
  QSocketNotifier: Can only be used with threads started with QThread`
- Use removePaths instead of disconnect to stop the watcher from
  signalling. This avoids an error when the editor is forcibly cleaned
  up by the tests without the signal ever being connected, but otherwise
  has the same behavior as disconnecting the singal.
- wait for a signal on write instead of proc closed
- wait for _watcher.fileChanged in test_unreadable to ensure the write
  event is fired before the test exits.
2018-01-27 15:03:18 -05:00
Fritz Reichwald
dc66ec5d8c Fix expectation in Fullscreen info message to fit new description of 2018-01-06 20:01:57 +01:00
Florian Bruhin
e65c0dd8a7 pylint: Re-enable bad-continuation
And lots and lots of whitespace changes.
2017-12-15 19:16:55 +01:00
Florian Bruhin
7cebd95936 Simplify test_getitem 2017-12-15 14:41:38 +01:00
Florian Bruhin
e76732693c Fix wrong import order 2017-12-15 14:35:07 +01:00
Florian Bruhin
0a612db733 Rename/move encoding test 2017-12-13 21:13:47 +01:00
Florian Bruhin
ddcdfa54aa Fix test for invalid guiprocess encoding 2017-12-13 21:12:56 +01:00
Florian Bruhin
2b3250144b Merge remote-tracking branch 'origin/pr/3388' 2017-12-13 20:06:00 +01:00
George Edward Bulmer
84e0ce757a Fix erroneous docstring in a recently added test. 2017-12-13 14:50:25 +00:00
George Edward Bulmer
28961ab177 Add a test with invalid unicode in spawned stdout.
stderr features identical behaviour, so is currently untested.
2017-12-13 12:46:46 +00:00
George Edward Bulmer
9ca6baca4f Modify instances of re.match to fullmatch or search.
This applies the changes to the tests directory only.
2017-12-12 15:07:37 +00:00
George Edward Bulmer
a2bcd68d56 Code review changes.
This fixes whitespace and alignment issues, and removes a stray test.
2017-12-11 13:35:39 +00:00
George Edward Bulmer
3b10584749 Update tests to work with the earlier consumption of stdin etc.
Note: this adds an element to vulture's whitelist that vulture
mistakenly identified as unused.
2017-12-10 23:46:35 +00:00
Florian Bruhin
dcb4448594 Merge remote-tracking branch 'origin/pr/3345' 2017-12-06 06:51:03 +01:00
Florian Bruhin
b5dd647678 Upgrade pydocstyle/flake8-docstrings
See #3320
2017-11-26 20:30:32 +01:00
mhm@mhm.com
aa40842848 lazy sessions, docstring formatted, settings renamed, javascript notice changed, insert method changed 2017-11-21 00:38:51 +01:00
Florian Bruhin
112800bab9 Fix backslashes in string 2017-11-19 21:04:57 +01:00
Florian Bruhin
8fb03208e7 Improve parsing of fatal stacktraces
We now also recognize "Windows fatal exception: ..." message and refuse to
send empty Windows access violation messages.
2017-11-19 14:06:11 +01:00
Florian Bruhin
180fb0d65a Fix handling of caret position with Qt 5.10
With Chromium 61 in Qt 5.10, we get null when getting .selectionStart on a
non-text element, like changed in the WhatWG HTML standard:
https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-textarea/input-selectionstart

See https://www.chromestatus.com/feature/5740194741354496

Older QtWebEngines and QtWebKit raise InvalidStateError instead.

This also changes the surrounding code and API so None is used to say "there's
no caret position available", which seems like a nicer API.
2017-11-08 16:27:26 +01:00
Florian Bruhin
9a69ccc9e3 Merge remote-tracking branch 'origin/pr/3100' 2017-11-02 11:32:45 +01:00
Gyorgy Orban
bb54a954fe use subprocess run
The usage of subprocess.run is recommended since python 3.5.
Popen, check_call, call and check_output calls were replaced with run.
2017-11-01 09:59:32 +01:00
Luca Benci
f195b7e4d2 Fix flake8 failures 2017-10-25 21:18:53 +02:00
Florian Bruhin
ed2f473a8e Make it more clear that :messages helps with failing processes 2017-10-24 22:56:04 +02:00
siddhugolu
bc9d305354 modified as requested 2017-10-23 01:46:02 +05:30
siddhugolu
4862b2faf9 modified pylint pragmas 2017-10-22 23:52:35 +05:30
Florian Bruhin
13116b2679 Stabilize IPC test
We can get earlier log messages from objreg
2017-10-21 19:02:35 +02:00
Luca Benci
9b177ae8e7 Remove single-function test class (move test out) 2017-10-18 20:33:14 +02:00
Luca Benci
6f1b9b7984 Add tests for line & column calculation 2017-10-17 23:19:10 +02:00
Florian Bruhin
96bec9f9d7 Fix error code for "database is locked"
See #2930
2017-10-17 15:35:23 +02:00
Florian Bruhin
7adab9ec78 Fix long line 2017-10-16 09:58:44 +02:00
Florian Bruhin
5307b97ca5 Improve checkpyver error message 2017-10-16 09:24:31 +02:00
Florian Bruhin
b5777299fd Fix getting a short text from the SqlError 2017-10-09 16:08:56 +02:00
Florian Bruhin
b608259751 Handle some sqlite errors gracefully
We mark some SQL errors as "environmental", and then show those as error
messages instead of raising an exception.

Fixes #3004
Workaround for #2930
2017-10-09 16:06:24 +02:00
Florian Bruhin
cdf0cf56fa Merge remote-tracking branch 'origin/pr/3056' 2017-10-04 06:45:08 +02:00