Commit Graph

362 Commits

Author SHA1 Message Date
ZyX b845cc25b4 Fix tests on python-2.6
csv module does not appear to work will with multiline strings in csv, 
especially incomplete.
2014-11-10 01:08:37 +03:00
ZyX c9cb856acd Add support for vim_func_exists to tests/vim.py 2014-11-10 00:35:40 +03:00
ZyX d392cf3322 Add support for csv files
Equivalent to airline csv Christian Brabandt plugin integration, but uses Python
own facilities.

Note: filetype detection is out of the scope of the powerline responsibilities.
      CSV is supported by powerline, but only as long as filetype detection is
      done by Vim correctly. By default CSV files are neither detected nor
      highlighted.

Some known differences between powerline code and @chrisbra plugin with
corresponding airline integration:

1. Detection work differently. I cannot say which is better because I have not
   tested it much, but it is definitely different.
2. My variant is able to detect whether there is (no) header. (Of course,
   relying on Python code.) Airline is using a setting. (Both do not allow
   manual per-filetype setting.) Of course, user can force either variant (no
   headers at all or headers always).
3. My variant makes it possible to configure header output format, including
   truncating it at 15 characters (the default).
4. CSV plugin does not work with multiline CSV items (in some dialects one can
   use code like `abc;"I<CR>am<CR>multiline<CR>string"`). See `:h csv-column` on
   how to fix this if possible (will require also changing `<sid>WColumn`
   function because currently it only works with one line).
5. AFAIK Python does not such a thing as “fixed width CSV”. Thus I do not work
   with this, but CSV plugin does. Not sure whether it is different with
   space-separated CSV files though.
2014-11-09 23:54:49 +03:00
ZyX 28435f05d2 Add support for Command-T 2014-11-09 23:54:48 +03:00
ZyX fadd1eec17 Move all parser definitions to powerline.commands.*.get_argparser()
Reasoning: they will be easier to reach there. It will also be possible to use
specific ArgumentParser class that will just collect data for sphinx.
2014-10-25 22:03:33 +04:00
ZyX 0d3609fb96 Specify $TERM in place of assuming it is set to something working
Ref #1104
2014-10-12 00:41:06 +04:00
ZyX d1ac624c7f Fix broken tests 2014-10-12 00:36:53 +04:00
ZyX 8b1a502f0d Add ignore_statuses option to branch segments
Closes #1080
2014-09-26 00:34:32 +04:00
ZyX 3f2aabb77b Refactor Vim and common branch segments to share code 2014-09-26 00:20:58 +04:00
ZyX c68eb56f7c Raise exceptions that are not intercepted when testing
Thus problems like in #1087 will result in build failure.
2014-09-21 15:53:22 +04:00
ZyX 679b66466f Fix WM bindings tests 2014-09-21 15:53:22 +04:00
ZyX fcf5702b7f Use pwd.getpwuid or getpass.getuser to get current user name 2014-09-21 15:26:27 +04:00
ZyX bb5977c8eb Fix tests with <psutil-2.0 2014-09-21 15:11:01 +04:00
ZyX 26365a9620 Split powerline.segments.common into a number of modules
Note: some modules (i.e wthr and bat) have their names in order to avoid the 
situation when module name matches segment name:

    import powerline.segments.common.weather

will import weather segment because `powerline.segments.common` contains line 
`from powerline.segments.common.weather import weather`.

Fixes #1083
2014-09-21 02:00:37 +04:00
ZyX 77b0695caf Replace all ASCII ' with Unicode ’ in comments and docstrings 2014-09-20 17:48:15 +04:00
ZyX 8587d14598 Link git executable to tests/shell/path 2014-09-20 14:43:45 +04:00
ZyX 48e06cbf9e Refactor weather segment to use KwThreaded segment
Problem: weather segment used to set its state (i.e. user location) once and 
remember it forever.
2014-09-20 13:52:24 +04:00
ZyX 92b75aa951 Also catch INotifyError when testing tree watcher 2014-09-14 19:26:37 +04:00
ZyX 4e91f18908 Run watcher tests with bytes() arguments 2014-09-14 19:26:36 +04:00
ZyX be7056fd7d Allow bytes paths in VCS bindings 2014-09-14 19:26:36 +04:00
ZyX e7d0c8368e Add code that will return bytes() from vim functions in Python-3 2014-09-14 17:21:11 +04:00
ZyX a4e711dae7 Add tests for invalid unicode filenames
Ref #1071
2014-09-14 14:26:42 +04:00
ZyX d14aecbc0a Use proper encoding to convert values in various places
Fixes #1072
2014-09-14 14:26:42 +04:00
ZyX fa217185cf Encode vim statusline to &encoding before returning
Partially fixes #1072
2014-09-14 14:26:42 +04:00
Nikolai Aleksandrovich Pavlov 257732bd82 Merge pull request #1069 from ZyX-I/workaround-1068
Do not use _POWERLINE_SHORTENED_PATH or unset it shortly after using
2014-09-09 00:22:33 +04:00
ZyX 901d96e3e1 Add tests 2014-09-09 00:04:56 +04:00
ZyX d3b57f7c31 Include args.config_path in the key
Consider the following script:

    % powerline-daemon -s powerline-test
    % powerline --socket powerline-test -p/dev/null shell left
    Config file not found in search paths (/dev/null): config.json
    % powerline --socket powerline-test shell left
    Config file not found in search paths (/dev/null): config.json

Note the problem: second call to powerline does not use offending path, but it 
still emits the error “Config file not found in search paths”.
2014-09-08 23:53:05 +04:00
ZyX fb022b7917 Check that exception from watcher has errno attribute equal to ENOENT 2014-09-07 23:23:23 +04:00
ZyX 05cb133dd4 Replace g:powerline_config_path Vim variable with …_paths list
This is for consistency with other powerline bindings that now all do have a way 
to specify a list of paths.
2014-09-05 22:13:51 +04:00
ZyX 68263beec4 Show current buffer, window and tabpage number by default
Fixes #1048
2014-09-05 20:00:21 +04:00
ZyX d569c0b3dd Skip identical highlighting
Fixes #1049
2014-09-05 20:00:20 +04:00
ZyX 1a5bbbea96 Replace segment-local modes with highlight_group_prefix option
Fixes #1046
2014-09-05 20:00:20 +04:00
ZyX 667cd4bce5 Assume highlight group is always an iterable
According to the documentation and linter `'highlight_group': 'string'` was not
correct even at the current stage, but it worked. This commit fixes this
situation.
2014-09-05 20:00:20 +04:00
ZyX 54e12b1515 Use new functionality to replace tabbuflister and single_tab segment 2014-09-05 20:00:19 +04:00
ZyX c5ca1b23c4 Use class setup/teardown methods to use vim module mock 2014-09-05 20:00:19 +04:00
ZyX 7bf025ca2b Add `exclude_/include_function` support
This is first step towards fixing #1046.
2014-09-05 20:00:19 +04:00
ZyX bc557bd656 Use replace_item to add module `bar` to sys.modules
Tests should not leave modified environment.
2014-09-04 21:38:49 +04:00
ZyX 8588885b04 In vim tests check for printed messages 2014-09-04 08:32:36 +04:00
ZyX b638a8e1c9 Add tests for is_watching method
Currently they fail for uv-based watcher.
2014-09-02 21:58:42 +04:00
ZyX 06211cbe63 Unify imports
Now imports follow the following structure:

1. __future__ line: exactly one line allowed:

        from __future__ import (unicode_literals, division, absolute_import, print_function)

   (powerline.shell is the only exception due to problems with argparse).
2. Standard python library imports in a form `import X`.
3. Standard python library imports in a form `from X import Y`.
4. and 5. 2. and 3. for third-party (non-python and non-powerline imports).
6. 3. for powerline non-test imports.
7. and 8. 2. and 3. for powerline testing module imports.

Each list entry is separated by exactly one newline from another import. If
there is module docstring it goes between `# vim:` comment and `__future__`
import. So the structure containing all items is the following:

    #!/usr/bin/env python
    # vim:fileencoding=utf-8:noet

    '''Powerline super module'''

    import sys

    from argparse import ArgumentParser

    import psutil

    from colormath.color_diff import delta_e_cie2000

    from powerline.lib.unicode import u

    import tests.vim as vim_module

    from tests import TestCase

.
2014-09-01 00:25:24 +04:00
ZyX 2505d0b827 Implement segment truncation
Closes #161 (requires implementation for specific segments though)
2014-08-30 18:22:52 +04:00
ZyX d6c603daf0 Add support for `segment.expand`
Closes #154
2014-08-30 18:22:46 +04:00
ZyX bfa335d96a Fix typo in test_configuration.py 2014-08-30 17:59:58 +04:00
ZyX 0da40f08a5 Fix syntastic error 2014-08-30 17:59:58 +04:00
ZyX 8d3376ce07 Ultimately disable pyuv watcher tests 2014-08-30 15:49:50 +04:00
ZyX 560600fca9 Use shutil.rmtree in tests 2014-08-30 15:47:31 +04:00
ZyX 0ee5293e1a Add tests for libuv-based watcher
Four possible results of running tests (first three are errors):

- “The change to inotify/file2 was not detected” on line 84: most common
- “Spurious change detected” at line 82 (uncommon, usually fixed by sleeping
  before running test in do_test_for_change)
- “The change to inotify was not detected” in tree watcher test (e.g. from line
  131) (very rare)
- All OK.
2014-08-30 15:45:30 +04:00
ZyX 10e8d9bb15 Do not use &> in #!/bin/sh scripts 2014-08-29 23:21:19 +04:00
ZyX 41476544ca Replace `name` and `module` keys with `function` key
Fixes #1031
2014-08-29 23:13:10 +04:00
ZyX 5bd543ae89 Do not run daemon when running with ONLY_TEST_TYPE=nodaemon 2014-08-29 23:13:10 +04:00