Commit graph

178 commits

Author SHA1 Message Date
Tomas Janousek
d66a7b5b94 cache: Mark buffer as modified on push
When a (task)wiki file is opened, viewports are refreshed but the buffer
is not marked as modified and therefore a subsequent :xa doesn't update
the file. This is, IMO, undesired.

vim documentation for the 'modified' option:

    This option is not set when a change is made to the buffer as the
    result of a BufNewFile, BufRead/BufReadPost, BufWritePost,
    FileAppendPost or VimLeave autocommand event.  See |gzip-example| for
    an explanation.
2020-09-23 02:18:46 -04:00
Tomas Janousek
1e3ccb16f8 vwtags: Distinguish (tag kinds) between header, preset and viewport
For tagbar to correctly nest the tags, we need to remember kinds of
parent scopes as well. This wasn't done in the original taskwiki
implementation.
2020-09-23 02:03:47 -04:00
Tomas Janousek
07dc2b8ceb vwtags: Viewports/presets shown using their name only
In other words hide the parts behind `|`. Handle vimwiki links
correctly.
2020-09-23 02:03:47 -04:00
Tomas Janousek
91f98d54b3 tests: Add basic tests for vwtags 2020-09-23 02:03:47 -04:00
Tomas Janousek
7b67d510cc cache: Get markup_syntax from vimwiki, drop g:taskwiki_markup_syntax
I don't see the point of forcing the user to select this manually in
both vimwiki and taskwiki.
2020-09-18 11:31:49 -04:00
Tomas Janousek
f3fe7aca21 ftplugin: Only load the python plugin once
This makes opening wiki pages significantly faster and also prevents
clearing the entire cache every time.
2020-09-18 11:28:39 -04:00
Tomas Janousek
b722c29f9e ftplugin: Make commands buffer-local
Consistency with vimwiki, less confusion/clutter.
2020-09-18 11:28:39 -04:00
Tomas Janousek
29adb30f00 vwtask: Require spaces around --
There's -- in Google Drive URLs which I sometimes add to my task
descriptions.
2020-08-02 18:14:00 -04:00
Tomas Janousek
f2d1c162e2 tests: Fix "Different tests were collected" in python 3.5
pytest-xdist requires all subprocesses to collect the tests in the same
order. Python 3.5, however, randomizes order of dict keys.
2020-08-02 17:24:20 -04:00
Xyank
9565f1f30e Fix priority field in sort order
Did not actually change the code. Instead changed the docs referring to
the "priority" field incorrectly as "pri", and changed `constants.py` to
reflect the correct name for it.
2020-07-12 09:54:58 -04:00
Tomas Janousek
15ce16f24c Revert "tests: Use explicit coverage tracking"
This reverts commit b00e886142.

This fixes reporting of coverage by the few tests that run outside of
vim.

The commit that is being reverted doesn't explain why it was committed,
and the git history suggests it was reverted once and then reintroduced
later again. None of those commits explains the why. I can only guess
that the last time this was committed was an attempt to fix coverage
reporting to outside of docker, which it didn't, and additionally it
made coverage gathering less robust (see previous commit). So this is
yet another fix for the inaccurate coverage reporting.

Or maybe it was because `--cov` without `=taskwiki` an argument reports
coverage for tests instead of taskwiki code? Nevermind, I guess, now it
works well.
2020-07-08 21:36:52 -04:00
Tomas Janousek
7d5b902c89 tests: Do not load vimwiki/taskwiki twice
Since c8c3cc9a00, vimwiki filetype is set
automatically by :edit, and `set filetype=vimwiki` loads everything
again.

One consequence of loading taskwiki twice is that
taskwiki/testcoverage.py is sourced twice, the Coverage object is
initialized, started, stopped and saved twice (with the same data
filename!) and the coverage report is inaccurate as two trackers write
into the same file.
2020-07-08 21:36:52 -04:00
Tomas Janousek
14c0268438 tests: Upgrade vimrunner and drop the now unnecessary hacks
This makes the tests less brittle and potentially also faster.
2020-07-02 09:51:56 -04:00
Tomas Janousek
4efe2c83d6 tests: Refactor the self.tasks resetting hack 2020-07-02 09:51:56 -04:00
Tomas Janousek
7f47669e0c tests: Run tests in parallel using pytest-xdist 2020-07-02 09:51:56 -04:00
Tomas Janousek
ae924a2afc tests: Drop unnecessary markup_syntax from MockCache 2020-07-02 09:51:56 -04:00
Tomas Janousek
6dd4d81aec tests: Use "default" syntax instead of "mediawiki" (for consistency) 2020-07-02 09:51:56 -04:00
Tomas Janousek
698e2448f3 tests: Fix vimwiki loading errors
Not only can we stop ignoring the errors, this also fixes
TestInfoActionNotTriggeredByEnterOnLink which would otherwise cause vim
to complain about g:vimwiki_wikilocal_vars not being available.
2020-07-02 09:51:56 -04:00
Tomas Janousek
789d04f488 tests: Catch vim errors in read_buffer
Without this, TestInfoActionNotTriggeredByEnterOnLink would pass because
it asserts that the buffer is empty, which is what read_buffer returned
if vim was stuck showing an error message. With `PYTEST_FLAGS=-s`, it
would additionally log

    E449: Invalid expression received: Send expression failed.

but that's easy to miss.
2020-07-02 09:51:56 -04:00
Tomas Janousek
9457b509cf tests: Simplify MultiSyntaxIntegrationTest.test_execute
Remove duplicated code.
2020-07-02 09:51:56 -04:00
Tomas Janousek
4e40a969f0 tests: Quit vim more reliably
`TestSuppressedMapping` leaves vim in visual mode and
`vimrunner.Client.quit()` fails with "E481: No range allowed" resulting
in

    Vim: Caught deadly signal TERM
    Vim: Finished.

This is probably harmless as the `quit()` is followed by `pkill`, but
let's do it the right way anyway.
2020-07-02 09:51:56 -04:00
Tomas Janousek
78105f4aca tests: Fix setting vim up twice
Since 8d8fd2c20b, the first `setup`
invocation sets g:taskwiki_markup_syntax="None" which is then detected
in `check_sanity` and vim is restarted, this time with correct
g:taskwiki_markup_syntax. This is wasteful and weird, but makes a bit of
sense as a hack to make `MultiSyntaxIntegrationTest` work as the
test_syntax fixture is not available in `setup`.

To fix this:

 * make `teardown` idempotent
 * let `check_sanity` fail early if the client is not set up yet
 * disable `setup` in `MultiSyntaxIntegrationTest`
 * let the sanity check and restart logic handle the setup in
   `MultiSyntaxIntegrationTest` once `markup` is available
2020-07-02 09:51:56 -04:00
Tomas Janousek
3edeef5960 tests: Report details about failed assertions in tests.base 2020-07-02 09:51:56 -04:00
Tomas Janousek
1cb822455c tests: Drop some (hopefully) unnecessary sleeps
vimrunner.Server.remote_expr waits for the result so we don't need to
sleep, except perhaps if vim does something asynchronously?
Anyway, this doesn't seem to break any tests here, and is noticeably
faster.
2020-07-02 09:51:56 -04:00
Tomas Janousek
c8c3cc9a00 tests: Fix misquoted g:vimwiki_list setting
vimrunner.Client.command doesn't do any escaping so we can only use
double quotes. Otherwise it does this:

    self.server.remote_expr(["VimrunnerPyEvaluateCommandOutput('let g:vimwiki_list = [{'syntax': 'mediawiki', 'ext': '.txt','path': '/tmp/tmpl1hh2nnf'}]')"])
    E449: Invalid expression received: Send expression failed.
2020-07-02 09:51:56 -04:00
Tomas Janousek
6609c541eb tests: Fix typo varialbes → variables 2020-07-02 09:51:56 -04:00
Tomas Janousek
c2627a14ad tests: Fix PEP 8 warnings in base.py 2020-07-02 09:51:56 -04:00
mrossinek
97bfa1315c
Add unit tests to test fix of #182 (allow colon remap) 2019-02-24 12:08:54 -05:00
mrossinek
504aefadef
Add unit tests for default, suppressed and custom mappings 2019-02-24 12:08:52 -05:00
DancingQuanta
8d8fd2c20b Implemented multIi-markup tests in vim of viewport and preset 2018-10-18 01:00:29 -04:00
DancingQuanta
159d5c4b79 Implemented multi-markup parsing tests for viewport and preset 2018-10-18 01:00:29 -04:00
DancingQuanta
920c065d98 extra-syntaxes: First of test suite of extra syntaxes using HEADER macro with test_syntax_parsing 2018-10-18 01:00:29 -04:00
Tomas Babej
b00e886142
tests: Use explicit coverage tracking 2018-07-31 03:46:58 -04:00
Bodo Graumann
5bf0c89ae8 Use preset header in vwtask and viewport 2018-07-17 21:53:18 -04:00
Bodo Graumann
4372d52298 Add new header type "Preset Header"
As first envisioned in #69, these preset headers allow us to have a
hierarchical structure of taskwarrior filters and defaults.
2018-07-17 21:53:18 -04:00
Tomas Babej
3e615c27e3
tests: Provide more helpful message when looking for scripts 2018-07-15 18:26:30 -04:00
Tomas Babej
dfc2aef502
tests: Update list of script paths 2018-07-15 18:26:19 -04:00
Tomas Babej
496bf34dfa tests: Add test for preservation of default+custom tags in a viewport generated task 2017-07-31 17:22:57 +02:00
Bodo Graumann
895b36d4d4 Test: Only kill gvim instances with custom name
Vimrunner-python allows to set a custom server name, which is used with
the `--servername` parameter for `gvim`. This way we can restrict the
killing of gvim instances to those, that we have used. For that purpose
we use the standard linux `pkill` utility instead of `killall`.
2017-07-31 00:54:08 +02:00
Bodo Graumann
0225b44e53 tests: Add regression test for multiple caches 2017-01-27 22:23:33 +01:00
Bodo Graumann
8f51f2f4c2 main: Use one cache object for each buffer 2017-01-27 22:23:33 +01:00
Bodo Graumann
32a1c45685 VimwikiTask: Omit 00:00 time from due date 2017-01-27 20:24:34 +01:00
Tomas Babej
0eedf6f3ef Revert "Mappings: Delegate to VimwikiFollowLink for link creation"
This reverts commit 0ac7da0fde.
The commit contained code that was included by mistake.
2017-01-27 14:43:25 +01:00
Bodo Graumann
7e70ba9935 tests: Test invalid parent-child task relation 2017-01-27 10:55:01 +01:00
Bodo Graumann
a22ad7e3cb tests: Allow running tests with en_GB locale 2017-01-27 10:55:01 +01:00
Bodo Graumann
ab4c7646a4 IntegrationTest: correctly retry start_client 2017-01-27 10:55:01 +01:00
Tomas Babej
0ac7da0fde Mappings: Delegate to VimwikiFollowLink for link creation 2017-01-27 10:29:34 +01:00
Tomas Babej
4b55082413 tests: Test proper precise detection of vimwiki links 2017-01-11 11:17:39 +01:00
Tomas Babej
1de1835eff tests: Extend coverage of the redo command 2017-01-11 10:22:40 +01:00
Tomas Babej
1dd6d45016 tests: Add initial test coverate for TaskWikiRedo 2017-01-11 09:53:27 +01:00